Package apron

Class Texpr0Node

java.lang.Object
apron.Texpr0Node
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Texpr0BinNode, Texpr0CstNode, Texpr0DimNode, Texpr0UnNode

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

A Texpr0Node represents an expression tree, which can be constructed and inspected in Java. Each node is actually a binary operator (Texpr0BinNode), a unary operator (Texpr0UnNode), a variable represented by dimension (Texpr0DimNode), or a constant (Texpr0CstNode).

An expression tree must be converted to and from a Texpr0Intern to be used in abstract domain transfer functions.

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
    abstract void
    Adds some dimensions and shifts coefficients accordingly .
    Returns a copy of this with some dimensions added.
    Returns a deep copy of this.
    abstract Texpr0Node
    Deep copy.
    abstract boolean
    Whether x is a Texpr0 tree and structurally equal to this.
    protected abstract void
    fillDims(boolean[] ar)
    Used internally by getDims.
    static Texpr0Node
    Constructs an expression tree from a linear expression.
    abstract int
    Returns the depth of the expression tree.
    int[]
    Returns an ordered list of all occurring dimensions.
    abstract int
    Precedence of the node, used when printing.
    abstract int
    Returns the number of internal nodes in the tree.
    abstract boolean
    hasDim(int dim)
    Whether the dimension dim is present.
    abstract int
    Recursive hashing.
    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 int
    Maximum occurring dimension + 1.
    abstract void
    Permutes some dimensions in the expression.
    Returns a copy of this with some dimensions permuted.
    abstract Texpr0Node
    Removes some dimensions and shifts coefficients accordingly
    Returns a copy of this with some dimensions removed.
    abstract Texpr0Node
    Shallow copy.
    abstract Texpr0Node
    substitute(int dim, Texpr0Node t)
    Substitutes all occurrences of the dimension dim with the expression tree t.
    Returns a copy of this where all occurrences of the dimension dim are substituted with the expression tree t.
    static String
    suffixRDir(int rdir)
    Suffix String representation of a rounding direction.
    static String
    suffixRType(int rtype)
    Suffix String representation of a rounding type.
    Converts the expression tree to a String.
    abstract String
    toString(Var[] names)
    Converts the expression tree to a String.
    toString(String[] names)
     
    abstract Texpr1Node
    Converts the level 0 tree to a level 1 tree in environment e.

    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

    • Texpr0Node

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

    • shallowCopy

      public abstract Texpr0Node shallowCopy()
      Shallow copy.
    • deepCopy

      public abstract Texpr0Node deepCopy()
      Deep copy.
    • fromLinexpr0

      public static Texpr0Node fromLinexpr0(Linexpr0 c)
      Constructs an expression tree from a linear expression.

      All coefficients are copied.

    • toTexpr1Node

      public abstract Texpr1Node toTexpr1Node(Environment e)
      Converts the level 0 tree to a level 1 tree in environment e.

      All dimension leaves are replaced with variable leaves.

    • toString

      public String toString()
      Converts the expression tree to a String.

      Dimension i is denoted as xi.

      Overrides:
      toString in class Object
    • toString

      public abstract String toString(Var[] names)
      Converts the expression tree to a String.

      Dimension i is denoted by names[i].

    • toString

      public String toString(String[] names)
    • 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.
    • maxDim

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

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

      protected abstract void fillDims(boolean[] ar)
      Used internally by getDims.
    • getDims

      public int[] getDims()
      Returns an ordered list of all occurring dimensions.
    • 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 Texpr0Node substitute(int dim, Texpr0Node t)
      Substitutes all occurrences of the dimension dim with the expression tree t.

      this is modified in-place.

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

    • substituteCopy

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

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

      public Texpr0Node addDimensionsCopy(Dimchange c)
      Returns a copy of this with some dimensions added.
    • removeDimensions

      public abstract Texpr0Node removeDimensions(Dimchange c)
      Removes some dimensions and shifts coefficients accordingly

      this is modified in-place.

      As some nodes can change their kind (removed dimensions become [-oo,+oo] constants), a new root node is returned.

    • removeDimensionsCopy

      public Texpr0Node removeDimensionsCopy(Dimchange c)
      Returns a copy of this with some dimensions removed.
    • permuteDimensions

      public abstract void permuteDimensions(Dimperm p)
      Permutes some dimensions in the expression.
    • permuteDimensionsCopy

      public Texpr0Node permuteDimensionsCopy(Dimperm p)
      Returns a copy of this with some dimensions permuted.
    • hashCode

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

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

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

      public static String suffixRType(int rtype)
      Suffix String representation of a rounding type.
    • suffixRDir

      public static String suffixRDir(int rdir)
      Suffix String representation of a rounding direction.
    • clone

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

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