Class Constraint

    • Constructor Detail

      • Constraint

        Constraint()
        Constructor for serialization.
      • Constraint

        public Constraint​(IModelElement parent)
        Constructor for a new Constraint.
        Parameters:
        parent - the object, in which this specific one is embedded
      • Constraint

        public Constraint​(java.lang.String name,
                          IModelElement parent)
        Constructor for a new Constraint.
        Parameters:
        name - the name of a constraint
        parent - 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 tree
        parent - 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​(java.lang.String name,
                          ConstraintSyntaxTree consSyntax,
                          IModelElement parent)
                   throws CSTSemanticException
        Creates a new constraint from an already parsed syntax tree.
        Parameters:
        name - the name of a constraint
        consSyntax - the constraint syntax tree
        parent - 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 Detail

      • getConsSyntax

        public ConstraintSyntaxTree getConsSyntax()
        Getter-Method for the ConstraintSyntaxTree.
        Returns:
        the ConstraintSytnaxTree
      • setConsSyntax

        public void setConsSyntax​(ConstraintSyntaxTree consSyntax)
                           throws CSTSemanticException
        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

        private static java.lang.String check​(ConstraintSyntaxTree cst)
                                       throws CSTSemanticException
        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
      • isBooleanConstraint

        public boolean isBooleanConstraint()
        Returns whether this constraint is a boolean constraint.
        Returns:
        true if it is a boolean constraint, false otherwise (please note that false does not even imply that this constraint is valid)
      • getAttachedTo

        public java.lang.Object 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

        public Constraint createConstraint​(ConstraintSyntaxTree consSyntax)
                                    throws CSTSemanticException
        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