Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.ValueSpecification


    for (final Iterator<EObject> iterator = root.eAllContents(); iterator.hasNext();) {
      final EObject object = iterator.next();
      if (object instanceof Abstraction) {
        final Element supplier = ((Abstraction)object).getSupplier(e.getName());
        if (supplier != null) {
          Stereotype s = ((Abstraction)object).getAppliedStereotype("SysML::Requirements::Satisfy");
          if (s != null) {
            deleteAssociatedStereotype((Abstraction)object, "SysML::Requirements::Satisfy");
          } else {
            s = ((Abstraction)object).getAppliedStereotype("SysML::Requirements::DeriveReqt");
            if (s != null) {
View Full Code Here


   *            the given Element.
   * @return th element updated.
   */
  public Element updateStereotype(Element element) {
    if (element instanceof Property) {
      final Type type = ((Property)element).getType();
      if (type != null) {
        final Collection<EObject> elementStereotypes = element.getStereotypeApplications();
        final Collection<EObject> typeStereotypes = type.getStereotypeApplications();
        for (EObject typeStereotype : typeStereotypes) {
          if (typeStereotype instanceof ConstraintBlock) {
            if (elementStereotypes == null || elementStereotypes.isEmpty()) {
              createAssociatedStereotype(element, "SysML::Constraints", "ConstraintProperty");
              break;
View Full Code Here

   * <!-- begin-user-doc --> <!-- end-user-doc -->
   *
   * @generated
   */
  public void setProbability(ValueSpecification newProbability) {
    ValueSpecification oldProbability = probability;
    probability = newProbability;
    if(eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ActivitiesPackage.PROBABILITY__PROBABILITY, oldProbability, probability));
  }
View Full Code Here

    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");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(false);
    when(slotIter.next()).thenReturn(slot);
    when(slot.getDefiningFeature()).thenReturn(property);

    when(property.getType()).thenReturn(type);
    when(type.getName()).thenReturn("Integer");

    when(slot.getValues()).thenReturn(valueSpecifications);
    when(valueSpecifications.iterator()).thenReturn(valueSpecificationIter);
    when(valueSpecificationIter.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter.next()).thenReturn(valueSpecification);
    when(valueSpecification.integerValue()).thenReturn(0);

    enumGenerator.generateConstants(enumeration, ast, ed);

    assertEquals("public enum Company {HOME(0)}\n", ed.toString());
  }
View Full Code Here

    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");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(false);
    when(slotIter.next()).thenReturn(slot);
    when(slot.getDefiningFeature()).thenReturn(property);

    when(property.getType()).thenReturn(type);
    when(type.getName()).thenReturn("String");

    when(slot.getValues()).thenReturn(valueSpecifications);
    when(valueSpecifications.iterator()).thenReturn(valueSpecificationIter);
    when(valueSpecificationIter.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter.next()).thenReturn(valueSpecification);
    when(valueSpecification.stringValue()).thenReturn("Home");

    enumGenerator.generateConstants(enumeration, ast, ed);

    assertEquals("public enum Company {HOME(\"Home\")}\n", ed.toString());
  }
View Full Code Here

    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");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(false);
    when(slotIter.next()).thenReturn(slot);
    when(slot.getDefiningFeature()).thenReturn(property);

    when(property.getType()).thenReturn(type);
    when(type.getName()).thenReturn("Long");

    when(slot.getValues()).thenReturn(valueSpecifications);
    when(valueSpecifications.iterator()).thenReturn(valueSpecificationIter);
    when(valueSpecificationIter.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter.next()).thenReturn(valueSpecification);
    when(valueSpecification.integerValue()).thenReturn(1);

    enumGenerator.generateConstants(enumeration, ast, ed);

    assertEquals("public enum Company {HOME(1L)}\n", ed.toString());
  }
View Full Code Here

    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");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(false);
    when(slotIter.next()).thenReturn(slot);
    when(slot.getDefiningFeature()).thenReturn(property);

    when(property.getType()).thenReturn(type);
    when(type.getName()).thenReturn("boolean");

    when(slot.getValues()).thenReturn(valueSpecifications);
    when(valueSpecifications.iterator()).thenReturn(valueSpecificationIter);
    when(valueSpecificationIter.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter.next()).thenReturn(valueSpecification);
    when(valueSpecification.booleanValue()).thenReturn(true);

    enumGenerator.generateConstants(enumeration, ast, ed);

    assertEquals("public enum Company {HOME(true)}\n", ed.toString());
  }
View Full Code Here

    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");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);

    when(property1.getType()).thenReturn(type1);
    when(property2.getType()).thenReturn(type2);
    when(property1.getName()).thenReturn("type");
    when(property2.getName()).thenReturn("name");
    when(type1.getName()).thenReturn("boolean");
    when(type2.getName()).thenReturn("String");

    when(slot1.getValues()).thenReturn(valueSpecifications1);
    when(slot2.getValues()).thenReturn(valueSpecifications2);
    when(valueSpecifications1.iterator()).thenReturn(
        valueSpecificationIter1);
    when(valueSpecifications2.iterator()).thenReturn(
        valueSpecificationIter2);
    when(valueSpecificationIter1.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter2.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter1.next()).thenReturn(valueSpecification1);
    when(valueSpecificationIter2.next()).thenReturn(valueSpecification2);
    when(valueSpecification1.booleanValue()).thenReturn(true);
    when(valueSpecification2.stringValue()).thenReturn("Lofi");

    ArrayList<String> constructorParameterNames = new ArrayList<String>();
    constructorParameterNames.add("type");
    constructorParameterNames.add("name");
    enumGenerator.setConstructorParameterNames(constructorParameterNames);
View Full Code Here

    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");

    when(enumLiteral.getSlots()).thenReturn(slots1).thenReturn(slots2);
    when(slots1.iterator()).thenReturn(slotIter1);
    when(slots2.iterator()).thenReturn(slotIter2);
    when(slotIter1.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter2.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter1.next()).thenReturn(slot1).thenReturn(slot2);
    when(slotIter2.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);

    when(property1.getType()).thenReturn(type1);
    when(property2.getType()).thenReturn(type2);
    when(property1.getName()).thenReturn("type");
    when(property2.getName()).thenReturn("name");
    when(type1.getName()).thenReturn("boolean");
    when(type2.getName()).thenReturn("String");

    when(slot1.getValues()).thenReturn(valueSpecifications1);
    when(slot2.getValues()).thenReturn(valueSpecifications2);
    when(valueSpecifications1.iterator()).thenReturn(
        valueSpecificationIter1);
    when(valueSpecifications2.iterator()).thenReturn(
        valueSpecificationIter2);
    when(valueSpecificationIter1.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter2.hasNext()).thenReturn(true).thenReturn(
        false);
    when(valueSpecificationIter1.next()).thenReturn(valueSpecification1);
    when(valueSpecificationIter2.next()).thenReturn(valueSpecification2);
    when(valueSpecification1.booleanValue()).thenReturn(true);
    when(valueSpecification2.stringValue()).thenReturn("Lofi");

    // Cannot find the parameter name of the constructor!
    ArrayList<String> constructorParameterNames = new ArrayList<String>();
    constructorParameterNames.add("typeX");
    constructorParameterNames.add("nameY");
View Full Code Here

    }
    return comment;
  }

  public String getDefaultValue(Property property) {
    ValueSpecification vs = property.getDefaultValue();

    if (vs == null) {
      if (property.getType() instanceof PrimitiveType) {
        PrimitiveType pt = (PrimitiveType) property.getType();
        if (pt.getName().equals("int")) {
          return "0";
        }
      }
      return "null";
    } else {
      if (vs.getType() == null) {
        return vs.stringValue();
      } else if (vs.getType().getName().equals("String")) {
        return vs.stringValue();
      } else if (vs.getType().getName().equals("Integer")) {
        return vs.integerValue() + "";
      } else if (vs.getType().getName().equals("Boolean")) {
        return vs.booleanValue() + "";
      }
      return vs.stringValue();
    }
  }
View Full Code Here

TOP

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

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.