public class Tcons1
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
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.
Modifier and Type | Field and Description |
---|---|
protected Tcons0 |
cons
Level 0 constraint.
|
static int |
DISEQ
Disquality constraint: expr <> 0.
|
protected Environment |
env
Environment.
|
static int |
EQ
Equality constraint: expr = 0.
|
static int |
EQMOD
Congruence equality constraint modulo a constant: expr = 0 mod scalar.
|
static int |
SUP
Strict inequality constraint: expr > 0.
|
static int |
SUPEQ
Inequality constraint: expr >= 0.
|
Constructor and Description |
---|
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.
|
Tcons1(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(Lincons1 c)
Converts a linear constraint to a comb-line tree expression constraint.
|
Tcons1(Tcons1 c)
Constructs a copy of c.
|
Modifier and Type | Method and Description |
---|---|
Tcons1 |
clone()
Returns a copy of this.
|
boolean |
equals(java.lang.Object x)
Whether x is a Tcons1 and structurally equal to this.
|
void |
extendEnvironment(Environment e)
Expands the constraint to fit the given environment.
|
Tcons1 |
extendEnvironmentCopy(Environment e)
Returns a constraint expanded to fit the given environment.
|
int |
getDepth()
Returns the depth of the expression tree.
|
Environment |
getEnvironment()
Returns the environment of the constraint.
|
int |
getKind()
Returns the constraint kind.
|
Scalar |
getScalar()
Returns the optional modulo factor (may be null).
|
int |
getSize()
Returns the number of internal nodes in the tree.
|
Tcons0 |
getTcons0()
Returns a copy of the Tcons0 underlying the constraint.
|
Tcons0 |
getTcons0Ref()
Returns a (read-only) reference to the Tcons0 underlying
this constraint.
|
Var[] |
getVars()
Returns the list of all occurring variables.
|
int |
hashCode()
Returns a hash of the constraint.
|
boolean |
hasVar(java.lang.String var) |
boolean |
hasVar(Var var)
Whether the variable var is present.
|
boolean |
isEqual(Tcons1 x)
Whether x and this are structurally equal.
|
boolean |
isIntervalCst()
Whether the expression is constant.
|
boolean |
isIntervalLinear()
Whether the expression is linear with interval or scalar coefficients,
and there is no rounding.
|
boolean |
isIntervalPolyfrac()
Whether the expression is a polynomial fraction, with interval or
scalar coefficients, and there is no rounding.
|
boolean |
isIntervalPolynomial()
Whether the expression is polynomial, with interval or scalar
coefficients, and there is no rounding.
|
boolean |
isScalar()
Whether all coefficients are scalar (non interval).
|
static Tcons1 |
make(Environment v,
Tcons0 x)
This function is used internally to construct a level 1 constraint
by referencing a level 0 constraint.
|
void |
setKind(int k)
Changes the kind of constraint.
|
void |
setScalar(Scalar s)
Sets the optional modulo factor (may be null).
|
void |
substitute(java.lang.String var,
Texpr1Intern t) |
void |
substitute(Var var,
Texpr1Intern t)
Substitutes all occurrences of the variable var with
the expression tree t.
|
Tcons1 |
substituteCopy(java.lang.String var,
Texpr1Intern t) |
Tcons1 |
substituteCopy(Var var,
Texpr1Intern t)
Returns a copy of this where all occurrences of the variable var
are substituted with the expression tree t.
|
java.lang.String |
toString()
Returns a string representation of the constraint.
|
Texpr1Node |
toTexpr1Node()
Converts the expression tree to a concrete Java tree.
|
protected Tcons0 cons
protected Environment env
public static final int EQ
public static final int SUPEQ
public static final int SUP
public static final int EQMOD
public static final int DISEQ
public Tcons1(int k, Texpr1Intern e)
e is copied.
public Tcons1(int k, Texpr1Intern e, Scalar s)
e is copied, s is referenced.
public Tcons1(Environment v, int k, Texpr1Node e)
public Tcons1(Environment v, int k, Texpr1Node e, Scalar s)
public Tcons1(Tcons1 c)
The left member expression and the optional scalar are copied.
public Tcons1(Lincons1 c)
public Tcons1(Environment e, Tcons0 x)
All coefficients are copied.
The environment must be large enough for all variables in x.
public static Tcons1 make(Environment v, Tcons0 x)
The level 0 constraint should no longer be used afterwards.
public Environment getEnvironment()
public int getKind()
public Scalar getScalar()
public Texpr1Node toTexpr1Node()
public Tcons0 getTcons0()
public Tcons0 getTcons0Ref()
Warning: it is dangerous to add, remove, or permute dimensions as it may desynchrnonize the Tcons0 dimensions form the environment.
public int getDepth()
public int getSize()
public boolean hasVar(java.lang.String var)
public boolean hasVar(Var var)
public Var[] getVars()
The ordering is that of dimensions.
public boolean isIntervalCst()
public boolean isIntervalLinear()
public boolean isIntervalPolynomial()
public boolean isIntervalPolyfrac()
public boolean isScalar()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void setKind(int k)
public void setScalar(Scalar s)
public void substitute(java.lang.String var, Texpr1Intern t)
public void substitute(Var var, Texpr1Intern t)
this and t must be defined on the same environment.
public Tcons1 substituteCopy(java.lang.String var, Texpr1Intern t)
public Tcons1 substituteCopy(Var var, Texpr1Intern t)
this and t must be defined on the same environment.
this is not modified.
public void extendEnvironment(Environment e)
e must be a super-environment of that of this.
public Tcons1 extendEnvironmentCopy(Environment e)
e must be a super-environment of that of this.
this is not modified.
public Tcons1 clone()
clone
in class java.lang.Object
public boolean isEqual(Tcons1 x)
public boolean equals(java.lang.Object x)
equals
in class java.lang.Object