Class Interval

  • All Implemented Interfaces:
    it.unive.lisa.analysis.BaseLattice<Interval>, it.unive.lisa.analysis.Lattice<Interval>, it.unive.lisa.analysis.nonrelational.NonRelationalDomain<Interval,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<Interval>>, it.unive.lisa.analysis.nonrelational.NonRelationalElement<Interval,​it.unive.lisa.symbolic.value.ValueExpression,​it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<Interval>>, it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>, it.unive.lisa.analysis.nonrelational.value.NonRelationalValueDomain<Interval>, it.unive.lisa.analysis.SemanticEvaluator, it.unive.lisa.util.representation.StructuredObject, java.lang.Comparable<Interval>

    public class Interval
    extends java.lang.Object
    implements it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>, java.lang.Comparable<Interval>
    The overflow-insensitive interval abstract domain, approximating integer values as the minimum integer interval containing them. It is implemented as a BaseNonRelationalValueDomain, handling top and bottom values for the expression evaluation and bottom values for the expression satisfiability. Top and bottom cases for least upper bounds, widening and less or equals operations are handled by BaseLattice in BaseLattice.lub(L), BaseLattice.widening(L) and BaseLattice.lessOrEqual(L) methods, respectively.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain

        it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain.EvaluationVisitor<T extends it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<T>>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Interval BOTTOM
      The abstract bottom element.
      it.unive.lisa.util.numeric.IntInterval interval
      The interval represented by this domain element.
      static Interval TOP
      The abstract top ([-Inf, +Inf]) element.
      static Interval ZERO
      The abstract zero ([0, 0]) element.
      • Fields inherited from interface it.unive.lisa.analysis.Lattice

        BOTTOM_STRING, TOP_STRING
    • Constructor Summary

      Constructors 
      Constructor Description
      Interval()
      Builds the top interval.
      Interval​(int low, int high)
      Builds the interval.
      Interval​(it.unive.lisa.util.numeric.IntInterval interval)
      Builds the interval.
      Interval​(it.unive.lisa.util.numeric.MathNumber low, it.unive.lisa.util.numeric.MathNumber high)
      Builds the interval.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<Interval> assumeBinaryExpression​(it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<Interval> environment, it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, it.unive.lisa.symbolic.value.ValueExpression left, it.unive.lisa.symbolic.value.ValueExpression right, it.unive.lisa.program.cfg.ProgramPoint src, it.unive.lisa.program.cfg.ProgramPoint dest, it.unive.lisa.analysis.SemanticOracle oracle)  
      Interval bottom()  
      int compareTo​(Interval o)  
      boolean equals​(java.lang.Object obj)  
      Interval evalBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, Interval left, Interval right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      Interval evalNonNullConstant​(it.unive.lisa.symbolic.value.Constant constant, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      Interval evalUnaryExpression​(it.unive.lisa.symbolic.value.operator.unary.UnaryOperator operator, Interval arg, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      Interval glbAux​(Interval other)  
      int hashCode()  
      boolean is​(int n)
      Tests whether this interval instance corresponds (i.e., concretizes) exactly to the given integer.
      boolean isBottom()  
      boolean isTop()  
      boolean lessOrEqualAux​(Interval other)  
      Interval lubAux​(Interval other)  
      Interval narrowingAux​(Interval other)  
      it.unive.lisa.util.representation.StructuredRepresentation representation()  
      it.unive.lisa.analysis.lattices.Satisfiability satisfiesBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, Interval left, Interval right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      Interval top()  
      java.lang.String toString()  
      Interval wideningAux​(Interval other)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface it.unive.lisa.analysis.BaseLattice

        glb, lessOrEqual, lub, narrowing, widening
      • Methods inherited from interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain

        assume, assumeTernaryExpression, assumeUnaryExpression, canProcess, eval, evalIdentifier, evalNullConstant, evalPushAny, evalPushInv, evalSkip, evalTernaryExpression, evalTypeCast, evalTypeConv, evalValueExpression, satisfies, satisfiesAbstractValue, satisfiesNonNullConstant, satisfiesNullConstant, satisfiesTernaryExpression, satisfiesUnaryExpression
      • Methods inherited from interface it.unive.lisa.analysis.nonrelational.NonRelationalElement

        fixedVariable, unknownVariable
    • Field Detail

      • ZERO

        public static final Interval ZERO
        The abstract zero ([0, 0]) element.
      • TOP

        public static final Interval TOP
        The abstract top ([-Inf, +Inf]) element.
      • BOTTOM

        public static final Interval BOTTOM
        The abstract bottom element.
      • interval

        public final it.unive.lisa.util.numeric.IntInterval interval
        The interval represented by this domain element.
    • Constructor Detail

      • Interval

        public Interval​(it.unive.lisa.util.numeric.IntInterval interval)
        Builds the interval.
        Parameters:
        interval - the underlying IntInterval
      • Interval

        public Interval​(it.unive.lisa.util.numeric.MathNumber low,
                        it.unive.lisa.util.numeric.MathNumber high)
        Builds the interval.
        Parameters:
        low - the lower bound
        high - the higher bound
      • Interval

        public Interval​(int low,
                        int high)
        Builds the interval.
        Parameters:
        low - the lower bound
        high - the higher bound
      • Interval

        public Interval()
        Builds the top interval.
    • Method Detail

      • top

        public Interval top()
        Specified by:
        top in interface it.unive.lisa.analysis.Lattice<Interval>
      • isTop

        public boolean isTop()
        Specified by:
        isTop in interface it.unive.lisa.analysis.Lattice<Interval>
      • bottom

        public Interval bottom()
        Specified by:
        bottom in interface it.unive.lisa.analysis.Lattice<Interval>
      • isBottom

        public boolean isBottom()
        Specified by:
        isBottom in interface it.unive.lisa.analysis.Lattice<Interval>
      • representation

        public it.unive.lisa.util.representation.StructuredRepresentation representation()
        Specified by:
        representation in interface it.unive.lisa.util.representation.StructuredObject
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Overrides:
        toString in class java.lang.Object
      • evalNonNullConstant

        public Interval evalNonNullConstant​(it.unive.lisa.symbolic.value.Constant constant,
                                            it.unive.lisa.program.cfg.ProgramPoint pp,
                                            it.unive.lisa.analysis.SemanticOracle oracle)
        Specified by:
        evalNonNullConstant in interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>
      • evalUnaryExpression

        public Interval evalUnaryExpression​(it.unive.lisa.symbolic.value.operator.unary.UnaryOperator operator,
                                            Interval arg,
                                            it.unive.lisa.program.cfg.ProgramPoint pp,
                                            it.unive.lisa.analysis.SemanticOracle oracle)
        Specified by:
        evalUnaryExpression in interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>
      • is

        public boolean is​(int n)
        Tests whether this interval instance corresponds (i.e., concretizes) exactly to the given integer. The tests is performed through IntInterval.is(int).
        Parameters:
        n - the integer value
        Returns:
        true if that condition holds
      • evalBinaryExpression

        public Interval evalBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator,
                                             Interval left,
                                             Interval right,
                                             it.unive.lisa.program.cfg.ProgramPoint pp,
                                             it.unive.lisa.analysis.SemanticOracle oracle)
        Specified by:
        evalBinaryExpression in interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>
      • lubAux

        public Interval lubAux​(Interval other)
                        throws it.unive.lisa.analysis.SemanticException
        Specified by:
        lubAux in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • glbAux

        public Interval glbAux​(Interval other)
        Specified by:
        glbAux in interface it.unive.lisa.analysis.BaseLattice<Interval>
      • wideningAux

        public Interval wideningAux​(Interval other)
                             throws it.unive.lisa.analysis.SemanticException
        Specified by:
        wideningAux in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • narrowingAux

        public Interval narrowingAux​(Interval other)
                              throws it.unive.lisa.analysis.SemanticException
        Specified by:
        narrowingAux in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • lessOrEqualAux

        public boolean lessOrEqualAux​(Interval other)
                               throws it.unive.lisa.analysis.SemanticException
        Specified by:
        lessOrEqualAux in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • satisfiesBinaryExpression

        public it.unive.lisa.analysis.lattices.Satisfiability satisfiesBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator,
                                                                                        Interval left,
                                                                                        Interval right,
                                                                                        it.unive.lisa.program.cfg.ProgramPoint pp,
                                                                                        it.unive.lisa.analysis.SemanticOracle oracle)
        Specified by:
        satisfiesBinaryExpression in interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface it.unive.lisa.analysis.BaseLattice<Interval>
        Overrides:
        equals in class java.lang.Object
      • assumeBinaryExpression

        public it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<Interval> assumeBinaryExpression​(it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<Interval> environment,
                                                                                                            it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator,
                                                                                                            it.unive.lisa.symbolic.value.ValueExpression left,
                                                                                                            it.unive.lisa.symbolic.value.ValueExpression right,
                                                                                                            it.unive.lisa.program.cfg.ProgramPoint src,
                                                                                                            it.unive.lisa.program.cfg.ProgramPoint dest,
                                                                                                            it.unive.lisa.analysis.SemanticOracle oracle)
                                                                                                     throws it.unive.lisa.analysis.SemanticException
        Specified by:
        assumeBinaryExpression in interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Interval>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • compareTo

        public int compareTo​(Interval o)
        Specified by:
        compareTo in interface java.lang.Comparable<Interval>