public final class Constraint
extends java.lang.Object
Constraint
class stores a description of a constraint and provides facilities to
perform manipulations with it. The Constraint class allows describing various constraint types.
Depending on the constraint type (described by the kind field), its internal representation
(see the representation field) can use a different class to store the information.Constructor and Description |
---|
Constraint(java.lang.String name,
ConstraintKind kind,
java.lang.String description,
java.util.Map<java.lang.String,Variable> variables,
java.lang.Object representation)
Constructs a Constraint object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
Variable |
findVariable(java.lang.String name)
Finds a constraint variable by its name.
|
java.lang.String |
getDescription()
Returns the description of the constraint (some additional information).
|
java.lang.Object |
getInnerRep()
Returns an object that holds internal description of the constraint.
|
ConstraintKind |
getKind()
Returns information on the constraint type (including the format of its internals).
|
java.lang.String |
getName()
Returns the name that uniquely identifies a constraint.
|
java.util.Collection<Variable> |
getUnknownVariables()
Returns a collection of unknown constraint variables (that have no assigned value).
|
java.util.Collection<Variable> |
getVariables()
Returns a collection of constraint variables.
|
int |
hashCode() |
void |
setVariableValue(java.lang.String name,
Data value)
Assigns a value to a constraint variable (makes it an input variable).
|
java.lang.String |
toString() |
public Constraint(java.lang.String name, ConstraintKind kind, java.lang.String description, java.util.Map<java.lang.String,Variable> variables, java.lang.Object representation)
name
- Constraint name (uniquely identifies the constraint).kind
- Constraint type (gives information about its internal representation format).description
- Constraint description.variables
- Table of constraint variables.representation
- Description of the constraint internals (internal representation) in a
format that depends on the type of the constraint.java.lang.IllegalArgumentException
- if any of the parameters equals null.java.lang.IllegalArgumentException
- if the internal representation class does not match the class
required by the constraint type.public java.lang.String getName()
public ConstraintKind getKind()
public java.lang.String getDescription()
public java.lang.Object getInnerRep()
public void setVariableValue(java.lang.String name, Data value)
name
- The name of the variable.value
- The data object that stores the variable value.java.lang.IllegalArgumentException
- if any of the parameters equals null.java.lang.IllegalArgumentException
- (1) if a variable with such name is not defined; (2) if the
value type does not match the type of the variable.public Variable findVariable(java.lang.String name)
name
- The name of the variable to be searched for.java.lang.IllegalArgumentException
- if the name parameter equals null.public java.util.Collection<Variable> getVariables()
public java.util.Collection<Variable> getUnknownVariables()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object