Package apron

Class Tcons1

java.lang.Object
apron.Tcons1
All Implemented Interfaces:
Serializable, Cloneable

public class Tcons1 extends Object implements Cloneable, Serializable
Class of level 1 constraints on arbitrary expressions.

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 Details

    • cons

      protected Tcons0 cons
      Level 0 constraint.
    • env

      protected Environment env
      Environment.
    • EQ

      public static final int EQ
      Equality constraint: expr = 0.
      See Also:
    • SUPEQ

      public static final int SUPEQ
      Inequality constraint: expr >= 0.
      See Also:
    • SUP

      public static final int SUP
      Strict inequality constraint: expr > 0.
      See Also:
    • EQMOD

      public static final int EQMOD
      Congruence equality constraint modulo a constant: expr = 0 mod scalar.
      See Also:
    • DISEQ

      public static final int DISEQ
      Disquality constraint: expr <> 0.
      See Also:
  • Constructor Details

    • Tcons1

      public Tcons1(int k, Texpr1Intern e)
      Constructs a constraint with given kind and e as left member.

      e is copied.

    • Tcons1

      public Tcons1(int k, Texpr1Intern e, Scalar s)
      Constructs a constraint with given kind, e as left member, and s as modulo factor.

      e is copied, s is referenced.

    • Tcons1

      public Tcons1(Environment v, int k, Texpr1Node e)
      Constructs a constraint with given kind and e as left member.
    • Tcons1

      public 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

      public Tcons1(Tcons1 c)
      Constructs a copy of c.

      The left member expression and the optional scalar are copied.

    • Tcons1

      public Tcons1(Lincons1 c)
      Converts a linear constraint to a comb-line tree expression constraint.
    • Tcons1

      public Tcons1(Environment e, Tcons0 x)
      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

      public static Tcons1 make(Environment v, Tcons0 x)
      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

      public Environment getEnvironment()
      Returns the environment of the constraint.
    • getKind

      public int getKind()
      Returns the constraint kind.
    • getScalar

      public Scalar getScalar()
      Returns the optional modulo factor (may be null).
    • toTexpr1Node

      public Texpr1Node toTexpr1Node()
      Converts the expression tree to a concrete Java tree.
    • getTcons0

      public Tcons0 getTcons0()
      Returns a copy of the Tcons0 underlying the constraint.
    • getTcons0Ref

      public Tcons0 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

      public boolean hasVar(String var)
    • hasVar

      public boolean hasVar(Var var)
      Whether the variable var is present.
    • getVars

      public Var[] 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

      public String toString()
      Returns a string representation of the constraint.
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Returns a hash of the constraint.
      Overrides:
      hashCode in class Object
    • setKind

      public void setKind(int k)
      Changes the kind of constraint.
    • setScalar

      public void setScalar(Scalar s)
      Sets the optional modulo factor (may be null).
    • substitute

      public void substitute(String var, Texpr1Intern t)
    • substitute

      public void substitute(Var var, Texpr1Intern t)
      Substitutes all occurrences of the variable var with the expression tree t.

      this and t must be defined on the same environment.

    • substituteCopy

      public Tcons1 substituteCopy(String var, Texpr1Intern t)
    • substituteCopy

      public 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.

      this and t must be defined on the same environment.

      this is not modified.

    • extendEnvironment

      public void extendEnvironment(Environment e)
      Expands the constraint to fit the given environment.

      e must be a super-environment of that of this.

    • extendEnvironmentCopy

      public Tcons1 extendEnvironmentCopy(Environment e)
      Returns a constraint expanded to fit the given environment.

      e must be a super-environment of that of this.

      this is not modified.

    • clone

      public Tcons1 clone()
      Returns a copy of this.
      Overrides:
      clone in class Object
    • isEqual

      public boolean isEqual(Tcons1 x)
      Whether x and this are structurally equal.
    • equals

      public boolean equals(Object x)
      Whether x is a Tcons1 and structurally equal to this.
      Overrides:
      equals in class Object