UML.Semantic.Foundation.Core
Class Constraint

java.lang.Object
  |
  +--UML.Semantic.Foundation.Core.ModelElement
        |
        +--UML.Semantic.Foundation.Core.Constraint
All Implemented Interfaces:
Element, ElementAtt, LinkAtt

public class Constraint
extends ModelElement

A constraint is a semantic condition or restriction.

In the metamodel a Constraint is a BooleanExpression on an associated ModelElement(s) which must be true for the model to be well formed. This restriction can be stated in natural language, or in different kinds of languages with a well-defined semantics. Certain Constraints are predefined in the UML, others may be user defined. Note that a Constraint is an assertion, not an executable mechanism; it indicates a restriction that must be enforced by correct design of a system.


Constructor Summary
Constraint()
          Constructor.
 
Method Summary
 void add(BooleanExpression body)
          Sets the boolean expression of this constraint.
 boolean check()
          Checks if well-formedness rules are respected in this model element.
 BooleanExpression getBody()
          Gets the boolean expression of this constraint.
 void setConstrainedElement(java.lang.String constrainedElement)
          Sets the constrained element of this constraint.
 
Methods inherited from class UML.Semantic.Foundation.Core.ModelElement
add, add, getBindingList, getConstraintList, getElementType, getErrors, getHref, getId, getIdentification, getIdref, getIndex, getInfo, getIsOwned, getLabel, getLocator, getName, getNamespace, getNamespaceId, getStereotype, getTemplate, getTemplateParameterList, getTitle, getUuid, getUuidref, getVisibility, getVisibilitySymbol, getWarnings, setElementType, setErrors, setHref, setId, setIdref, setIndex, setIsOwned, setLabel, setName, setNamespace, setTemplate, setTitle, setUuid, setUuidref, setVisibility, setWarnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Constraint

public Constraint()
Constructor.

Method Detail

add

public void add(BooleanExpression body)
Sets the boolean expression of this constraint.


getBody

public BooleanExpression getBody()
Gets the boolean expression of this constraint.


setConstrainedElement

public void setConstrainedElement(java.lang.String constrainedElement)
Sets the constrained element of this constraint.


check

public boolean check()
Checks if well-formedness rules are respected in this model element.

Overrides:
check in class ModelElement
Returns:
True if check was successful, false otherwise.