Package net.ssehub.easy.varModel.model
Class Constraint
java.lang.Object
net.ssehub.easy.varModel.model.ModelElement
net.ssehub.easy.varModel.model.ContainableModelElement
net.ssehub.easy.varModel.model.Constraint
- All Implemented Interfaces:
IDatatypeVisitable,IModelElement,IPartialEvaluable
Class to create a rule-based constraint.
- Author:
- heiko beck, Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBase type for (extensible) constraint types.static enumThe conceptual type of the constraint. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for serialization.Constraint(String name, ConstraintSyntaxTree consSyntax, IModelElement parent) Creates a new constraint from an already parsed syntax tree.Constraint(String name, IModelElement parent) Constructor for a new Constraint.Constraint(ConstraintSyntaxTree consSyntax, IModelElement parent) Creates a new constraint from an already parsed syntax tree.Constraint(IModelElement parent) Constructor for a new Constraint. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IModelVisitor visitor) Accept method for the visitor.private static StringChecks a constraint syntax tree for validation properties.createConstraint(ConstraintSyntaxTree consSyntax) Creates a new constraint with same properties but changed constraint syntax tree.Returns the element, e.g., type, the constraint is attached to.Getter-Method for the ConstraintSyntaxTree.getType()Returns the conceptual type of the constraint.booleanReturns whether this constraint is a boolean constraint.voidsetConsSyntax(ConstraintSyntaxTree consSyntax) Changes the constraint syntax tree.toString()Methods inherited from class net.ssehub.easy.varModel.model.ContainableModelElement
accept, getNameSpace, getParent, getProject, getQualifiedName, getTopLevelParent, isTopLevel, setParentMethods inherited from class net.ssehub.easy.varModel.model.ModelElement
findAttribute, getComment, getName, getUniqueName, isTransparent, propagateAttribute, setComment, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.ssehub.easy.varModel.model.IPartialEvaluable
getParent
-
Field Details
-
consSyntax
-
-
Constructor Details
-
Constraint
Constraint()Constructor for serialization. -
Constraint
Constructor for a new Constraint.- Parameters:
parent- the object, in which this specific one is embedded
-
Constraint
Constructor for a new Constraint.- Parameters:
name- the name of a constraintparent- the object, in which this specific one is embedded
-
Constraint
public Constraint(ConstraintSyntaxTree consSyntax, IModelElement parent) throws CSTSemanticException Creates a new constraint from an already parsed syntax tree.- Parameters:
consSyntax- the constraint syntax treeparent- the object, in which this specific one is embedded- Throws:
CSTSemanticException- in case that the constraint semantics cannot be resolved or that the specified constraint does not evaluate to a boolean expression
-
Constraint
public Constraint(String name, ConstraintSyntaxTree consSyntax, IModelElement parent) throws CSTSemanticException Creates a new constraint from an already parsed syntax tree.- Parameters:
name- the name of a constraintconsSyntax- the constraint syntax treeparent- the object, in which this specific one is embedded- Throws:
CSTSemanticException- in case that the constraint semantics cannot be resolved or that the specified constraint does not evaluate to a boolean expression
-
-
Method Details
-
getConsSyntax
Getter-Method for the ConstraintSyntaxTree.- Returns:
- the ConstraintSytnaxTree
-
setConsSyntax
Changes the constraint syntax tree. [required as consequence of parent elements]- Parameters:
consSyntax- the constraint syntax tree- Throws:
CSTSemanticException- in case that the constraint semantics cannot be resolved or that the specified constraint does not evaluate to a boolean expression
-
check
Checks a constraint syntax tree for validation properties.- Parameters:
cst- the constraint syntax tree to be checked- Returns:
- null in case of no error, the error description in case of an error
- Throws:
CSTSemanticException- in case that the constraint semantics cannot be resolved or that the specified constraint does not evaluate to a boolean expression
-
accept
Description copied from interface:IPartialEvaluableAccept method for the visitor.- Specified by:
acceptin interfaceIModelElement- Specified by:
acceptin interfaceIPartialEvaluable- Parameters:
visitor- The visitor, which should process this model element.
-
isBooleanConstraint
public boolean isBooleanConstraint()Returns whether this constraint is a boolean constraint.- Returns:
trueif it is a boolean constraint,falseotherwise (please note thatfalsedoes not even imply that this constraint is valid)
-
toString
- Overrides:
toStringin classModelElement
-
getType
Returns the conceptual type of the constraint. Reasoners may return specialized types here.- Returns:
- the conceptual type (
Constraint.Type.USUAL)
-
getAttachedTo
Returns the element, e.g., type, the constraint is attached to. Reasoner may return specialized values here.- Returns:
- the attached object (null always)
-
createConstraint
Creates a new constraint with same properties but changed constraint syntax tree.- Parameters:
consSyntax- the syntax tree- Returns:
- the new constraint
- Throws:
CSTSemanticException- in case that the constraint semantics cannot be resolved or that the specified constraint does not evaluate to a boolean expression
-