Class Formulas
- java.lang.Object
-
- ru.ispras.fortress.solver.constraint.Formulas
-
public final class Formulas extends java.lang.Object
TheFormulas
class serves as a container for formula expressions (assertions) that specify the invariants for a taken constraint.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Node formula)
Adds a formula expression to the formula container.void
addAll(java.util.Collection<? extends Node> formulas)
Adds all formula expression from the specified collection to the formula container.void
addAll(Formulas formulas)
Adds all formula expressions from the specified formula container to the current formula container.Node
asSingleExpr()
Unites all stored formula expressions into a single expression using the AND operator and returns it to the client.boolean
equals(java.lang.Object obj)
java.util.List<Node>
exprs()
Provides access to the list of formula expressions.java.util.List<Variable>
getVariables()
Finds all variables used in the stored formula expressions and returns them to the client.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Formulas
public Formulas()
Constructs an empty formula container.
-
Formulas
public Formulas(Formulas formulas)
Constructs a new formula container by copying the contents of an existing one.- Parameters:
formulas
- Existing formula container.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
.
-
Formulas
public Formulas(Node formula)
Constructs a container than contains the specified formula.- Parameters:
formula
- A formula to be placed in the container.
-
-
Method Detail
-
add
public void add(Node formula)
Adds a formula expression to the formula container.- Parameters:
formula
- A formula expression.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
.
-
addAll
public void addAll(java.util.Collection<? extends Node> formulas)
Adds all formula expression from the specified collection to the formula container.- Parameters:
formulas
- A collection of formula expressions.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
.
-
addAll
public void addAll(Formulas formulas)
Adds all formula expressions from the specified formula container to the current formula container.- Parameters:
formulas
- Formula container to be copied.- Throws:
java.lang.IllegalArgumentException
- if the parameter equalsnull
.
-
exprs
public java.util.List<Node> exprs()
Provides access to the list of formula expressions.- Returns:
- List of formula expressions
-
asSingleExpr
public Node asSingleExpr()
Unites all stored formula expressions into a single expression using the AND operator and returns it to the client.- Returns:
- A single expression for all stored formula expressions.
-
getVariables
public java.util.List<Variable> getVariables()
Finds all variables used in the stored formula expressions and returns them to the client.- Returns:
- A list of all variables used in the stored formula expressions.
- Throws:
java.lang.IllegalStateException
- if the method finds nodes that refer to different variable instances that have the same name. This is illegal because all variables used in formula expression of a constraint must be accessible via its variable table (the signature of the constraint).
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-