コード例 #1
0
  /** @generated */
  public void init_Constraint_2008(Constraint instance) {
    try {
      OpaqueExpression newInstance_0_0 = UMLFactory.eINSTANCE.createOpaqueExpression();
      instance.setSpecification(newInstance_0_0);
      Object value_0_0_0 =
          UMLOCLFactory.getExpression(13, UMLPackage.eINSTANCE.getOpaqueExpression(), null)
              .evaluate(newInstance_0_0);
      if (value_0_0_0 instanceof Collection) {
        newInstance_0_0.getLanguages().clear();
        newInstance_0_0.getLanguages().addAll(((Collection) value_0_0_0));
      } else {
        newInstance_0_0.getLanguages().add((String) value_0_0_0);
      }
      Object value_0_0_1 =
          UMLOCLFactory.getExpression(14, UMLPackage.eINSTANCE.getOpaqueExpression(), null)
              .evaluate(newInstance_0_0);
      if (value_0_0_1 instanceof Collection) {
        newInstance_0_0.getBodies().clear();
        newInstance_0_0.getBodies().addAll(((Collection) value_0_0_1));
      } else {
        newInstance_0_0.getBodies().add((String) value_0_0_1);
      }

    } catch (RuntimeException e) {
      UMLDiagramEditorPlugin.getInstance()
          .logError("Element initialization failed", e); // $NON-NLS-1$				
    }
  }
コード例 #2
0
ファイル: CoreFactoryEUMLImpl.java プロジェクト: kfa/argouml
 public Constraint buildConstraint(String name, Object bexpr) {
   // TODO: BooleanExpresion is removed from UML2.x, is it OK to use
   // ValueSpecification?
   if (!(bexpr instanceof ValueSpecification)) {
     throw new IllegalArgumentException(
         "The 'bexpr' value specification must be " //$NON-NLS-1$
             + "instance of ValueSpecification"); //$NON-NLS-1$
   }
   Constraint constraint = createConstraint();
   if (name != null) {
     constraint.setName(name);
   }
   constraint.setSpecification((ValueSpecification) bexpr);
   return constraint;
 }