Class Tcons1
- All Implemented Interfaces:
Serializable,Cloneable
A Tcons1 represents a constraint over variables denoted by name in an environment.
A Tcons1 is implemented as a pair containing a
Tcons0 and an Environment,
manipulated in conjunction.
Direct access to the fields is prohibited, to avoid desynchronizing them.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Tcons0Level 0 constraint.static final intDisquality constraint: expr <> 0.protected EnvironmentEnvironment.static final intEquality constraint: expr = 0.static final intCongruence equality constraint modulo a constant: expr = 0 mod scalar.static final intStrict inequality constraint: expr > 0.static final intInequality constraint: expr >= 0. -
Constructor Summary
ConstructorsConstructorDescriptionTcons1(int k, Texpr1Intern e) Constructs a constraint with given kind and e as left member.Tcons1(int k, Texpr1Intern e, Scalar s) Constructs a constraint with given kind, e as left member, and s as modulo factor.Tcons1(Environment v, int k, Texpr1Node e) Constructs a constraint with given kind and e as left member.Tcons1(Environment v, int k, Texpr1Node e, Scalar s) Constructs a constraint with given kind, e as left member, and s as modulo factor.Tcons1(Environment e, Tcons0 x) Creates a new Tcons1 from a Tcons0.Converts a linear constraint to a comb-line tree expression constraint.Constructs a copy of c. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of this.booleanWhether x is a Tcons1 and structurally equal to this.voidExpands the constraint to fit the given environment.Returns a constraint expanded to fit the given environment.intgetDepth()Returns the depth of the expression tree.Returns the environment of the constraint.intgetKind()Returns the constraint kind.Returns the optional modulo factor (may be null).intgetSize()Returns the number of internal nodes in the tree.Returns a copy of the Tcons0 underlying the constraint.Returns a (read-only) reference to the Tcons0 underlying this constraint.Var[]getVars()Returns the list of all occurring variables.inthashCode()Returns a hash of the constraint.booleanWhether the variable var is present.booleanbooleanWhether x and this are structurally equal.booleanWhether the expression is constant.booleanWhether the expression is linear with interval or scalar coefficients, and there is no rounding.booleanWhether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding.booleanWhether the expression is polynomial, with interval or scalar coefficients, and there is no rounding.booleanisScalar()Whether all coefficients are scalar (non interval).static Tcons1make(Environment v, Tcons0 x) This function is used internally to construct a level 1 constraint by referencing a level 0 constraint.voidsetKind(int k) Changes the kind of constraint.voidSets the optional modulo factor (may be null).voidsubstitute(Var var, Texpr1Intern t) Substitutes all occurrences of the variable var with the expression tree t.voidsubstitute(String var, Texpr1Intern t) substituteCopy(Var var, Texpr1Intern t) Returns a copy of this where all occurrences of the variable var are substituted with the expression tree t.substituteCopy(String var, Texpr1Intern t) toString()Returns a string representation of the constraint.Converts the expression tree to a concrete Java tree.
-
Field Details
-
cons
Level 0 constraint. -
env
Environment. -
EQ
public static final int EQEquality constraint: expr = 0.- See Also:
-
SUPEQ
public static final int SUPEQInequality constraint: expr >= 0.- See Also:
-
SUP
public static final int SUPStrict inequality constraint: expr > 0.- See Also:
-
EQMOD
public static final int EQMODCongruence equality constraint modulo a constant: expr = 0 mod scalar.- See Also:
-
DISEQ
public static final int DISEQDisquality constraint: expr <> 0.- See Also:
-
-
Constructor Details
-
Tcons1
Constructs a constraint with given kind and e as left member.e is copied.
-
Tcons1
Constructs a constraint with given kind, e as left member, and s as modulo factor.e is copied, s is referenced.
-
Tcons1
Constructs a constraint with given kind and e as left member. -
Tcons1
Constructs a constraint with given kind, e as left member, and s as modulo factor. -
Tcons1
Constructs a copy of c.The left member expression and the optional scalar are copied.
-
Tcons1
Converts a linear constraint to a comb-line tree expression constraint. -
Tcons1
Creates a new Tcons1 from a Tcons0.All coefficients are copied.
The environment must be large enough for all variables in x.
-
-
Method Details
-
make
This function is used internally to construct a level 1 constraint by referencing a level 0 constraint.The level 0 constraint should no longer be used afterwards.
-
getEnvironment
Returns the environment of the constraint. -
getKind
public int getKind()Returns the constraint kind. -
getScalar
Returns the optional modulo factor (may be null). -
toTexpr1Node
Converts the expression tree to a concrete Java tree. -
getTcons0
Returns a copy of the Tcons0 underlying the constraint. -
getTcons0Ref
Returns a (read-only) reference to the Tcons0 underlying this constraint.Warning: it is dangerous to add, remove, or permute dimensions as it may desynchrnonize the Tcons0 dimensions form the environment.
-
getDepth
public int getDepth()Returns the depth of the expression tree. -
getSize
public int getSize()Returns the number of internal nodes in the tree. -
hasVar
-
hasVar
Whether the variable var is present. -
getVars
Returns the list of all occurring variables.The ordering is that of dimensions.
-
isIntervalCst
public boolean isIntervalCst()Whether the expression is constant. -
isIntervalLinear
public boolean isIntervalLinear()Whether the expression is linear with interval or scalar coefficients, and there is no rounding. -
isIntervalPolynomial
public boolean isIntervalPolynomial()Whether the expression is polynomial, with interval or scalar coefficients, and there is no rounding. -
isIntervalPolyfrac
public boolean isIntervalPolyfrac()Whether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding. -
isScalar
public boolean isScalar()Whether all coefficients are scalar (non interval). -
toString
Returns a string representation of the constraint. -
hashCode
public int hashCode()Returns a hash of the constraint. -
setKind
public void setKind(int k) Changes the kind of constraint. -
setScalar
Sets the optional modulo factor (may be null). -
substitute
-
substitute
Substitutes all occurrences of the variable var with the expression tree t.this and t must be defined on the same environment.
-
substituteCopy
-
substituteCopy
Returns a copy of this where all occurrences of the variable var are substituted with the expression tree t.this and t must be defined on the same environment.
this is not modified.
-
extendEnvironment
Expands the constraint to fit the given environment.e must be a super-environment of that of this.
-
extendEnvironmentCopy
Returns a constraint expanded to fit the given environment.e must be a super-environment of that of this.
this is not modified.
-
clone
Returns a copy of this. -
isEqual
Whether x and this are structurally equal. -
equals
Whether x is a Tcons1 and structurally equal to this.
-