Package apron

Class Tcons0

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

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

A Tcons0 represents a constraint over variables denoted by dimension (i.e., integer starting from 0). It has a left member (which is a Texpr0Intern level 0 opaque expression), a constraint operator (=, >=, >, <>, or = modulo), a right member which is always 0, and an optional constant modulo factor (for = modulo constraints only).

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Disquality constraint: expr <> 0.
    static final int
    Equality constraint: expr = 0.
    static final int
    Congruence equality constraint modulo a constant: expr = 0 mod scalar.
    Left member of the constraint.
    int
    Kind of constraint: EQ, SUPEQ, SUP, EQMOD, or DISEQ.
    Optional modulo factor.
    static final int
    Strict inequality constraint: expr > 0.
    static final int
    Inequality constraint: expr >= 0.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tcons0(int k, Texpr0Intern e)
    Constructs a constraint with given kind and e as left member.
    Tcons0(int k, Texpr0Intern e, Scalar s)
    Constructs a constraint with given kind, e as left member, and s as modulo factor.
    Tcons0(int k, Texpr0Node e)
    Constructs a constraint with given kind and e as left member.
    Tcons0(int k, Texpr0Node e, Scalar s)
    Constructs a constraint with given kind, e as left member, and s as modulo factor.
    Converts a linear constraint to a comb-line tree expression constraint.
    Constructs a copy of c.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds some dimensions and shifts coefficients accordingly .
    Returns a copy of the constraint with some dimensions added.
    Returns a copy of this.
    boolean
    Whether x is a Tcons0 tree and structurally equal to this.
    int
    Returns the depth of the expression tree.
    int[]
    Returns an ordered list of all occurring dimensions.
    Returns the left expression.
    int
    Returns the constraint kind.
    Returns the optional modulo factor (may be null).
    int
    Returns the number of internal nodes in the tree.
    boolean
    hasDim(int dim)
    Whether the dimension dim is present.
    int
    Returns a hash of the constraint.
    boolean
    Whether x and this are structurally equal.
    boolean
    Whether the expression is constant.
    boolean
    Whether the expression is linear with interval or scalar coefficients, and there is no rounding.
    boolean
    Whether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding.
    boolean
    Whether the expression is polynomial, with interval or scalar coefficients, and there is no rounding.
    boolean
    Whether all coefficients are scalar (non interval).
    int
    Maximum occurring dimension + 1.
    void
    Permutes some dimensions in the constraint.
    Returns a copy of the constraint with some dimensions permuted.
    void
    Removes some dimensions and shifts coefficients accordingly .
    Returns a copy of the constraint with some dimensions removed.
    void
    Sets the left expression.
    void
    setKind(int k)
    Sets the constraint kind.
    void
    Sets the optional modulo factor (may be null).
    void
    substitute(int dim, Texpr0Intern t)
    Substitutes all occurrences of the dimension dim with the tree t.
    Returns a copy of this where all occurrences of the dimension dim are substituted with the expression tree t.
    Returns a string representation of the constraint.
    toString(Var[] names)
    Returns a string representation of the constraint.
    toString(String[] names)
     
    Converts the expression tree to a concrete Java tree.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • expr

      public Texpr0Intern expr
      Left member of the constraint.
    • kind

      public int kind
      Kind of constraint: EQ, SUPEQ, SUP, EQMOD, or DISEQ.
    • scalar

      public Scalar scalar
      Optional modulo factor.

      null, except for EQMOD.

    • 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

    • Tcons0

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

      e is referenced, not copied.

    • Tcons0

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

      e and s are referenced, not copied.

    • Tcons0

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

      e is converted to an opaque Texpr0Intern Apron expression tree.

    • Tcons0

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

      e is converted to an opaque Texpr0Intern Apron expression tree.

    • Tcons0

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

      The left member expression and the optional scalar are copied.

    • Tcons0

      public Tcons0(Lincons0 c)
      Converts a linear constraint to a comb-line tree expression constraint.
  • Method Details

    • toString

      public String toString()
      Returns a string representation of the constraint.

      Dimension i is denoted as xi.

      Overrides:
      toString in class Object
    • toString

      public String toString(Var[] names)
      Returns a string representation of the constraint.

      Dimension i is denoted by names[i].

    • toString

      public String toString(String[] names)
    • hashCode

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

      public void substitute(int dim, Texpr0Intern t)
      Substitutes all occurrences of the dimension dim with the tree t.
    • substituteCopy

      public Tcons0 substituteCopy(int dim, Texpr0Intern t)
      Returns a copy of this where all occurrences of the dimension dim are substituted with the expression tree t.
    • addDimensions

      public void addDimensions(Dimchange c)
      Adds some dimensions and shifts coefficients accordingly .
    • removeDimensions

      public void removeDimensions(Dimchange c)
      Removes some dimensions and shifts coefficients accordingly .
    • permuteDimensions

      public void permuteDimensions(Dimperm p)
      Permutes some dimensions in the constraint.
    • addDimensionsCopy

      public Tcons0 addDimensionsCopy(Dimchange c)
      Returns a copy of the constraint with some dimensions added.

      this is not changed.

    • removeDimensionsCopy

      public Tcons0 removeDimensionsCopy(Dimchange c)
      Returns a copy of the constraint with some dimensions removed.

      this is not changed.

    • permuteDimensionsCopy

      public Tcons0 permuteDimensionsCopy(Dimperm p)
      Returns a copy of the constraint with some dimensions permuted.

      this is not changed.

    • 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).
    • toTexpr0Node

      public Texpr0Node toTexpr0Node()
      Converts the expression tree to a concrete Java tree.
    • getDepth

      public int getDepth()
      Returns the depth of the expression tree.
    • getSize

      public int getSize()
      Returns the number of internal nodes in the tree.
    • maxDim

      public int maxDim()
      Maximum occurring dimension + 1.
    • hasDim

      public boolean hasDim(int dim)
      Whether the dimension dim is present.
    • getDims

      public int[] getDims()
      Returns an ordered list of all occurring dimensions.
    • getExpression

      public Texpr0Intern getExpression()
      Returns the left expression.
    • getKind

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

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

      public void setExpression(Texpr0Intern e)
      Sets the left expression.
    • setKind

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

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

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

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

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