public ExpressionInOCL<Classifier, Parameter> getSpecification(Constraint constraint) { if (constraint.getSpecification() instanceof ExpressionInOCL<?, ?>) { return (org.eclipse.ocl.uml.ExpressionInOCL) constraint.getSpecification(); } return null; }
public List<Element> getConstrainedElements(Constraint constraint) { return constraint.getConstrainedElements(); }
public String getName() { return this.constraint.getName(); }
public static String getAsOcl(Constraint constraint) { Operation oper = (Operation) constraint.getContext(); StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(oper.getNearestPackage()).replace(".", "::")); sb.append("\ncontext "); sb.append(UmlgOperationOperations.asOclSignature(oper)); sb.append("\n"); sb.append("body: "); sb.append(constraint.getSpecification().stringValue()); sb.append("\n"); sb.append("endpackage"); return sb.toString(); }
Map<String, String> options, DiagnosticChain diagnostics, Map<Object, Object> context) { String name = constraint.getName(); .getSpecification();
public void setConstraintName(Constraint constraint, String name) { constraint.setName(name); }
.getSpecification(); OpaqueExpression expression = specification instanceof OpaqueExpression ? (OpaqueExpression) specification : (OpaqueExpression) bodyCondition.createSpecification( null, null, UMLPackage.Literals.OPAQUE_EXPRESSION);
if (ct.getKeywords().contains(UMLReflection.DEFINITION) && ct.getConstrainedElements().contains(umlFeature)) { result = ct; break;
@Override public boolean filter(Element e) { return e instanceof Constraint && ((Constraint) e).getContext().equals(element); } });
/** * @see org.andromda.metafacades.uml.GuardFacade#getTransition() */ @Override protected Transition handleGetTransition() { final Element owner = this.metaObject.getOwner(); if (owner instanceof Transition) { return (Transition)owner; } return null; } }
public String getConstraintOclAsString() { Namespace context = this.constraint.getContext(); ValueSpecification valueSpecification = this.constraint.getSpecification(); StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(context.getNearestPackage()).replace(".", "::")); sb.append("\n context "); sb.append(context.getName()); sb.append(" inv:"); sb.append("\n "); sb.append(valueSpecification.stringValue()); sb.append("\n"); sb.append("endpackage"); return sb.toString(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Constraint createPrecondition(String name, EClass eClass) { Constraint newPrecondition = (Constraint) create(eClass); getPreconditions().add(newPrecondition); if (name != null) newPrecondition.setName(name); return newPrecondition; }
/** * @see org.andromda.metafacades.uml.GuardFacade#getTransition() */ @Override protected Transition handleGetTransition() { final Element owner = this.metaObject.getOwner(); if (owner instanceof Transition) { return (Transition)owner; } return null; } }
/** * @see org.andromda.metafacades.uml.GuardFacade#getBody() */ @Override protected String handleGetBody() { String body = null; if (this.metaObject.getSpecification() != null) { body = this.metaObject.getSpecification().stringValue(); } return body; }
@Override public Object caseConstraint(Constraint constraint) { Namespace constraintContext = constraint.getContext(); if (constraintContext != null) { EModelElement eModelElement = (EModelElement) doSwitch(constraintContext); if (eModelElement != null) { if (eModelElement instanceof EClassifier && options != null && !OPTION__IGNORE.equals(options .get(OPTION__INVARIANT_CONSTRAINTS))) { eModelElement = processInvariantConstraint( (EClassifier) eModelElement, constraint, options, diagnostics, context); } ValueSpecification specification = constraint .getSpecification(); if (specification != null && !(eModelElement instanceof EOperation && options != null && OPTION__PROCESS .equals(options.get(OPERATION_BODY)))) { addDocumentation(eModelElement, specification .stringValue()); } return eModelElement; } } return super.caseConstraint(constraint); }
public void addConstrainedElement(Constraint constraint, EObject constrainedElement) { constraint.getConstrainedElements().add((Element) constrainedElement); }
public String getConstraintName(Constraint constraint) { return constraint.getName(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Constraint createOwnedRule(String name, EClass eClass) { Constraint newOwnedRule = (Constraint) create(eClass); getOwnedRules().add(newOwnedRule); if (name != null) newOwnedRule.setName(name); return newOwnedRule; }
/** * @see org.andromda.metafacades.uml.GuardFacade#getBody() */ @Override protected String handleGetBody() { String body = null; if (this.metaObject.getSpecification() != null) { body = this.metaObject.getSpecification().stringValue(); } return body; }
/** * @see org.andromda.metafacades.uml.ConstraintFacade#getContextElement() */ @Override protected Element handleGetContextElement() { Element element = null; final List<Element> elements = this.metaObject.getConstrainedElements(); if (elements != null && !elements.isEmpty()) { element = elements.get(0); } return element; } }