public final class ConstraintBuilder
extends java.lang.Object
Constructor and Description |
---|
ConstraintBuilder()
Constructs a ConstraintBuilder object with default values.
|
ConstraintBuilder(Constraint constraint)
Constructs a ConstraintBuilder object object using information from an existing Constraint
object.
|
ConstraintBuilder(ConstraintKind kind)
Constructs a ConstraintBuilder object using the provided constraint type.
|
Modifier and Type | Method and Description |
---|---|
Variable |
addVariable(java.lang.String name,
Data data)
Creates a variable that has the specified name and type, adds it to the constraint to be
created and returns a reference to it.
|
Variable |
addVariable(java.lang.String name,
DataType type)
Creates a variable that has the specified name and type, adds it to the constraint to be
created and returns a reference to it.
|
void |
addVariableCopies(java.lang.Iterable<Variable> variables)
Adds copies of variables in the specified collection to the constraint to be created.
|
void |
addVariables(java.lang.Iterable<Variable> variables)
Adds variables in the specified collection to the constraint to be created.
|
Constraint |
build()
Builds the Constraint object basing on the specified attributes and returns it.
|
void |
setDescription(java.lang.String description)
Sets the description of the constraint to be created.
|
void |
setInnerRep(java.lang.Object value)
Sets the internal representation of the constraint to be created.
|
void |
setKind(ConstraintKind kind)
Sets the type of the constraint to be created.
|
void |
setName(java.lang.String name)
Sets the name of the constraint to be created.
|
public ConstraintBuilder()
public ConstraintBuilder(ConstraintKind kind)
kind
- Constraint type.java.lang.NullPointerException
- if the parameter equals null.public ConstraintBuilder(Constraint constraint)
constraint
- An existing constraint.java.lang.NullPointerException
- if the parameter is null.public void setName(java.lang.String name)
name
- Constraint name.java.lang.NullPointerException
- if the parameter equals null.public void setDescription(java.lang.String description)
description
- Constraint description.java.lang.NullPointerException
- if the parameter equals null.public void setKind(ConstraintKind kind)
kind
- Constraint type.java.lang.NullPointerException
- if the parameter equals null.public void setInnerRep(java.lang.Object value)
value
- Internal representation of the constraint.java.lang.NullPointerException
- if the parameter equals null.public void addVariables(java.lang.Iterable<Variable> variables)
variables
- A collection of variables.java.lang.NullPointerException
- if the parameter equals null.java.lang.IllegalArgumentException
- if the specified variable name has already been use to define
a variable that has different type or value (an illegal attempt to redefine the
variable). See the internal addVariable method.public void addVariableCopies(java.lang.Iterable<Variable> variables)
variables
- A collection of variables.java.lang.NullPointerException
- if the parameter equals null.java.lang.IllegalArgumentException
- if the specified variable name has already been use to define
a variable that has different type or value (an illegal attempt to redefine the
variable). See the internal addVariable method.public Variable addVariable(java.lang.String name, DataType type)
name
- Variable name.type
- Variable type.java.lang.NullPointerException
- if any of the parameters equals null.java.lang.IllegalArgumentException
- if the specified variable name has already been use to define
a variable that has different type or value (an illegal attempt to redefine the
variable). See the internal addVariable method.public Variable addVariable(java.lang.String name, Data data)
name
- Variable name.data
- Data object that specifies the type and the value of the variable.java.lang.NullPointerException
- if any of the parameters equals null.java.lang.IllegalArgumentException
- if the specified variable name has already been use to define
a variable that has different type or value (an illegal attempt to redefine the
variable). See the internal addVariable method.public Constraint build()
java.lang.NullPointerException
- see the invariants of the Constraint class constructor.java.lang.IllegalArgumentException
- see the invariants of the Constraint class constructor.