Package apron

Class Texpr1Intern

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

public class Texpr1Intern extends Object implements Cloneable, Serializable
Class of level 1 expression trees in opaque Apron representation.

A Texpr1Intern represents an expression tree, with unary and binary operator nodes, and Coeff constant and variables (represented by names in an environment) leaves.

A Texpr1Intern is implemented as a pair containing an opaque level 0 tree Texpr0Intern and an Environment, manipulated in conjunction. Direct access to the fields is prohibited, to avoid desynchronizing them.

A Texpr1Intern encapsulates an Apron ap_texpr0_t object, an opaque object that can be passed to and retreived from Apron abstract domains. Texpr1Intern objects can be converted from and to Texpr1Node concrete expression trees for construction and inspection.

See Also:
  • Field Details

  • Constructor Details

    • Texpr1Intern

      public Texpr1Intern(Environment e, Texpr1Node t)
      Converts a Java concrete tree to an opaque Apron tree (deep copy).

      As concrete Texpr1Node trees do not specify an environment, it must be passed as argument to the conversion method.

    • Texpr1Intern

      public Texpr1Intern(Linexpr1 e)
      Converts a linear expression to a comb-like expression tree.
    • Texpr1Intern

      public Texpr1Intern(Texpr1Intern c)
      Deep copy.
    • Texpr1Intern

      public Texpr1Intern(Environment e, Texpr0Intern x)
      Creates a new Texpr1Intern from a Texpr0Intern.

      All coefficients are copied.

      The environment must be large enough for all variables in x.

  • Method Details

    • make

      public static Texpr1Intern make(Environment v, Texpr0Intern x)
      This function is used internally to construct a new level 1 expression from a level 0 expression.

      The level 0 expression should no longer be used afterwards.

    • toTexpr1Node

      public Texpr1Node toTexpr1Node()
      Converts an opaque Apron tree to a concrete Java tree.
    • getEnvironment

      public Environment getEnvironment()
      Returns the environment of the expression.
    • getTexpr0Intern

      public Texpr0Intern getTexpr0Intern()
      Returns a copy of the Texpr0Intern underlying this expression.
    • getTexpr0InternRef

      public Texpr0Intern getTexpr0InternRef()
      Returns a (read-only) reference to the Texpr0Intern underlying this expression.

      Warning: it is dangerous to add, remove, or permute dimensions as it may desynchrnonize the Texpr0Intern 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(Var var)
      Whether the variable var is present.
    • hasVar

      public boolean hasVar(String var)
    • 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).
    • hashCode

      public int hashCode()
      Recursive hashing.
      Overrides:
      hashCode in class Object
    • isEqual

      public boolean isEqual(Texpr1Intern t)
      Structural (recursive) equality.
    • toString

      public String toString()
      Converts the expression tree to a String.
      Overrides:
      toString in class Object
    • 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 Texpr0Intern substituteCopy(String var, Texpr1Intern t)
    • substituteCopy

      public Texpr0Intern 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 expression to fit the given environment.

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

    • extendEnvironmentCopy

      public Texpr1Intern extendEnvironmentCopy(Environment e)
      Returns an expression expanded to fit the given environment.

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

      this is not modified.

    • clone

      public Texpr1Intern clone()
      Returns a deep copy of this.
      Overrides:
      clone in class Object
    • equals

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