Package apron

Class Texpr1Node

java.lang.Object
apron.Texpr1Node
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Texpr1BinNode, Texpr1CstNode, Texpr1UnNode, Texpr1VarNode

public abstract class Texpr1Node extends Object implements Cloneable, Serializable
Class of level 1 concrete expression trees.

A Texpr1Node represents an expression tree, which can be constructed and inspected in Java. Each node is actually a binary operator (Texpr1BinNode), a unary operator (Texpr1UnNode), a variable represented by name (Texpr1VarNode), or a constant (Texpr1CstNode).

An expression tree must be converted to and from a Texpr1Intern to be used in abstract domain transfer functions. Unlike other level 1 objects, level 1 concrete expression trees are not defined with respect to a given environment. The environment is specified during the conversion to an opaque level 1 expression tree.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Rounds towards -oo.
    static final int
    Rounds to nearest.
    static final int
    Non-deterministic rounding (all four modes considered).
    static final int
    Rounds towards +oo.
    static final int
    Rounds towards 0 (truncation).
    static final int
    Double-precision rounding: 64-bit IEEE 754 (double).
    static final int
    Extended-precision rounding: 80-bit (Intel's long double).
    static final int
    Integer rounding.
    static final int
    Quad-precision rounding: 128-bit (Motorola's long double).
    static final int
    Real (no rounding).
    static final int
    Single-precision rounding: 32-bit IEEE 754 (float).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No constructor: use constructors from a sub-class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a deep copy of this.
    abstract Texpr1Node
    Deep copy.
    abstract boolean
    Whether x is a Texpr1 tree and structurally equal to this.
    protected abstract void
    Used internally for getVars.
    static Texpr1Node
    Constructs an expression tree from a linear expression.
    abstract int
    Returns the depth of the expression tree.
    abstract int
    Precedence of the node, used when printing.
    abstract int
    Returns the number of internal nodes in the tree.
    Var[]
    Returns the list of all occurring variables.
    abstract int
    Recursive hashing.
    abstract boolean
    hasVar(Var var)
    Whether the variable var occurs in the tree.
    boolean
     
    abstract boolean
    Structural (recursive) equality.
    abstract boolean
    Whether the expression is constant.
    abstract boolean
    Whether the expression is linear with interval or scalar coefficients, and there is no rounding.
    abstract boolean
    Whether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding.
    abstract boolean
    Whether the expression is polynomial, with interval or scalar coefficients, and there is no rounding.
    abstract boolean
    Whether all coefficients are scalar (non interval).
    abstract Texpr1Node
    Shallow copy.
    abstract Texpr1Node
    Substitutes all occurrences of the variable var with the tree t.
     
    Returns a copy of this where all occurrences of the variable var are substituted with the expression tree t.
     
    abstract String
    Converts the expression tree to a String.
    abstract Texpr0Node
    Converts the level 1 tree to a level 0 tree in the given environment.

    Methods inherited from class java.lang.Object

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

    • RTYPE_REAL

      public static final int RTYPE_REAL
      Real (no rounding).
      See Also:
    • RTYPE_INT

      public static final int RTYPE_INT
      Integer rounding.
      See Also:
    • RTYPE_SINGLE

      public static final int RTYPE_SINGLE
      Single-precision rounding: 32-bit IEEE 754 (float).
      See Also:
    • RTYPE_DOUBLE

      public static final int RTYPE_DOUBLE
      Double-precision rounding: 64-bit IEEE 754 (double).
      See Also:
    • RTYPE_EXTENDED

      public static final int RTYPE_EXTENDED
      Extended-precision rounding: 80-bit (Intel's long double).
      See Also:
    • RTYPE_QUAD

      public static final int RTYPE_QUAD
      Quad-precision rounding: 128-bit (Motorola's long double).
      See Also:
    • RDIR_NEAREST

      public static final int RDIR_NEAREST
      Rounds to nearest.
      See Also:
    • RDIR_ZERO

      public static final int RDIR_ZERO
      Rounds towards 0 (truncation).
      See Also:
    • RDIR_UP

      public static final int RDIR_UP
      Rounds towards +oo.
      See Also:
    • RDIR_DOWN

      public static final int RDIR_DOWN
      Rounds towards -oo.
      See Also:
    • RDIR_RND

      public static final int RDIR_RND
      Non-deterministic rounding (all four modes considered).
      See Also:
  • Constructor Details

    • Texpr1Node

      protected Texpr1Node()
      No constructor: use constructors from a sub-class.
  • Method Details

    • shallowCopy

      public abstract Texpr1Node shallowCopy()
      Shallow copy.
    • deepCopy

      public abstract Texpr1Node deepCopy()
      Deep copy.
    • fromLinexpr1

      public static Texpr1Node fromLinexpr1(Linexpr1 c)
      Constructs an expression tree from a linear expression.

      All coefficients are copied.

    • toTexpr0Node

      public abstract Texpr0Node toTexpr0Node(Environment e)
      Converts the level 1 tree to a level 0 tree in the given environment.
    • toString

      public abstract String toString()
      Converts the expression tree to a String.
      Overrides:
      toString in class Object
    • getDepth

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

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

      public abstract boolean hasVar(Var var)
      Whether the variable var occurs in the tree.
    • hasVar

      public boolean hasVar(String var)
    • fillVars

      protected abstract void fillVars(HashSet<Var> set)
      Used internally for getVars.
    • getVars

      public Var[] getVars()
      Returns the list of all occurring variables.

      The ordering is unspecified.

    • isIntervalCst

      public abstract boolean isIntervalCst()
      Whether the expression is constant.
    • isIntervalLinear

      public abstract boolean isIntervalLinear()
      Whether the expression is linear with interval or scalar coefficients, and there is no rounding.
    • isIntervalPolynomial

      public abstract boolean isIntervalPolynomial()
      Whether the expression is polynomial, with interval or scalar coefficients, and there is no rounding.
    • isIntervalPolyfrac

      public abstract boolean isIntervalPolyfrac()
      Whether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding.
    • isScalar

      public abstract boolean isScalar()
      Whether all coefficients are scalar (non interval).
    • substitute

      public abstract Texpr1Node substitute(Var var, Texpr1Node t)
      Substitutes all occurrences of the variable var with the tree t.

      this is modified in-place.

      As some nodes can change their kind (a node for a variable var becomes the root of the tree t), a new root node is returned.

    • substitute

      public Texpr1Node substitute(String var, Texpr1Node t)
    • substituteCopy

      public Texpr1Node substituteCopy(Var var, Texpr1Node t)
      Returns a copy of this where all occurrences of the variable var are substituted with the expression tree t.
    • substituteCopy

      public Texpr1Node substituteCopy(String var, Texpr1Node t)
    • hashCode

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

      public abstract boolean isEqual(Texpr1Node t)
      Structural (recursive) equality.
    • getPrecedence

      public abstract int getPrecedence()
      Precedence of the node, used when printing.
    • equals

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

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