Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Enumeration


    if(oVTR == null) {
      // the referenced object is no basic type -> create a new entry
      // ... for enumerations
      List<String> colEnumLiterals = new ArrayList<String>();
      if(in_oType instanceof Enumeration) {
        Enumeration oEnumeration = (Enumeration)in_oType;
        for(EnumerationLiteral oLiteral : oEnumeration.getOwnedLiterals()) {
          colEnumLiterals.add(oLiteral.getName());
        }
       
        EnumerableValueTypeRange<EnumerationValueType> oEnumerationValueTypeRange
          = new EnumerableValueTypeRange<EnumerationValueType>(new EnumerationValueType(colEnumLiterals));
View Full Code Here


      throw new TransformerException(e);
    }
  }

  private void generateEnum(Element element) throws IOException {
    Enumeration clazz = (Enumeration) element;
    logger.log(Level.FINE, "Enum: " + clazz.getName());
    // Generate the enumeration for this class
    CompilationUnit compilationUnit = enumGenerator.generateEnum(clazz,
        sourceDirectoryPackageName);
    generateClassFile(clazz, compilationUnit);
  }
View Full Code Here

   *            Enumeration declaration for Java JDT
   */
  @SuppressWarnings("unchecked")
  public void generateConstants(Classifier clazz, AST ast, EnumDeclaration ed) {
    // Get all properties for this enumeration
    Enumeration enumeration = (Enumeration) clazz;
    EList<EnumerationLiteral> enumerationLiterals = enumeration
        .getOwnedLiterals();
    for (EnumerationLiteral enumLiteral : enumerationLiterals) {
      EnumConstantDeclaration ec = ast.newEnumConstantDeclaration();
      ec.setName(ast.newSimpleName(enumLiteral.getName().toUpperCase()));

View Full Code Here

  public void testGenerateConstantsIntegerWithNoParamNames() {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    Enumeration enumeration = mock(Enumeration.class);
    EList<EnumerationLiteral> enumLiterals = mock(EList.class);
    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots = mock(EList.class);
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot = mock(Slot.class);

    Property property = mock(Property.class);
    Type type = mock(Type.class);

    EList<ValueSpecification> valueSpecifications = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter = mock(Iterator.class);
    ValueSpecification valueSpecification = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");
View Full Code Here

  public void testGenerateConstantsStringWithNoParamNames() {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    Enumeration enumeration = mock(Enumeration.class);
    EList<EnumerationLiteral> enumLiterals = mock(EList.class);
    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots = mock(EList.class);
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot = mock(Slot.class);

    Property property = mock(Property.class);
    Type type = mock(Type.class);

    EList<ValueSpecification> valueSpecifications = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter = mock(Iterator.class);
    ValueSpecification valueSpecification = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");
View Full Code Here

  public void testGenerateConstantsLongWithNoParamNames() {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    Enumeration enumeration = mock(Enumeration.class);
    EList<EnumerationLiteral> enumLiterals = mock(EList.class);
    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots = mock(EList.class);
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot = mock(Slot.class);

    Property property = mock(Property.class);
    Type type = mock(Type.class);

    EList<ValueSpecification> valueSpecifications = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter = mock(Iterator.class);
    ValueSpecification valueSpecification = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");
View Full Code Here

  public void testGenerateConstantsBooleanWithNoParamNames() {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    Enumeration enumeration = mock(Enumeration.class);
    EList<EnumerationLiteral> enumLiterals = mock(EList.class);
    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots = mock(EList.class);
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot = mock(Slot.class);

    Property property = mock(Property.class);
    Type type = mock(Type.class);

    EList<ValueSpecification> valueSpecifications = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter = mock(Iterator.class);
    ValueSpecification valueSpecification = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");
View Full Code Here

  public void testGenerateConstantsWithConstructorParameterNamesAndWithFoundSlot() {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    Enumeration enumeration = mock(Enumeration.class);
    EList<EnumerationLiteral> enumLiterals = mock(EList.class);
    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots = mock(EList.class);
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);

    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);
    Type type1 = mock(Type.class);
    Type type2 = mock(Type.class);

    EList<ValueSpecification> valueSpecifications1 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter1 = mock(Iterator.class);
    EList<ValueSpecification> valueSpecifications2 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter2 = mock(Iterator.class);
    ValueSpecification valueSpecification1 = mock(ValueSpecification.class);
    ValueSpecification valueSpecification2 = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");
View Full Code Here

    // TODO
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
    EnumDeclaration ed = enumGenerator.generateEnum(clazz, ast, cu);

    Enumeration enumeration = mock(Enumeration.class);
    EList<EnumerationLiteral> enumLiterals = mock(EList.class);
    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots1 = mock(EList.class);
    EList<Slot> slots2 = mock(EList.class);
    Iterator<Slot> slotIter1 = mock(Iterator.class);
    Iterator<Slot> slotIter2 = mock(Iterator.class);
    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);

    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);
    Type type1 = mock(Type.class);
    Type type2 = mock(Type.class);

    EList<ValueSpecification> valueSpecifications1 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter1 = mock(Iterator.class);
    EList<ValueSpecification> valueSpecifications2 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter2 = mock(Iterator.class);
    ValueSpecification valueSpecification1 = mock(ValueSpecification.class);
    ValueSpecification valueSpecification2 = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");
View Full Code Here

      parentProfile = Activator.getSysMLProfile();
    } else if (profileQualifiedName.startsWith("Standard")) {
      parentProfile = Activator.getStandardProfile();
    }

    Package profilePackage = parentProfile;

    final String[] profiles = profileQualifiedName.split(":{2}");
    // search the profile in the package hierarchy
    for (int index = 1; index < profiles.length - 1; index++) {
      profilePackage = profilePackage.getNestedPackage(profiles[index]);
    }

    Profile profile = (Profile)profilePackage;

    if (profileQualifiedName.startsWith("SysML")) {
      profile = (Profile)profilePackage.getNestedPackage(profiles[profiles.length - 1]);
    }

    if (profile == null) {
      final String message = "Can't apply the profile " + profileQualifiedName + " on "
          + p.getQualifiedName();
View Full Code Here

TOP

Related Classes of org.eclipse.uml2.uml.Enumeration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.