Class Tarsis

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

    public class Tarsis
    extends java.lang.Object
    implements it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Tarsis>, ContainsCharProvider
    A class that represent the Tarsis domain for strings, exploiting a RegexAutomaton.
    • 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 int WIDENING_CAP
      Maximum widening threshold, or default threshold if there is no difference in the size of the two automata.
      • Fields inherited from interface it.unive.lisa.analysis.Lattice

        BOTTOM_STRING, TOP_STRING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Tarsis bottom()  
      Tarsis concat​(Tarsis other)
      Yields the concatenation between two automata.
      it.unive.lisa.analysis.lattices.Satisfiability contains​(Tarsis other)
      Semantics of StringContains between this and other.
      it.unive.lisa.analysis.lattices.Satisfiability containsChar​(char c)
      Simplified semantics of the string contains operator, checking a single character is part of the string.
      boolean equals​(java.lang.Object o)  
      Tarsis evalBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, Tarsis left, Tarsis right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      Tarsis evalNonNullConstant​(it.unive.lisa.symbolic.value.Constant constant, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      Tarsis evalTernaryExpression​(it.unive.lisa.symbolic.value.operator.ternary.TernaryOperator operator, Tarsis left, Tarsis middle, Tarsis right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      RegexAutomaton getAutomaton()
      Yields the RegexAutomaton backing this domain element.
      Tarsis glbAux​(Tarsis other)  
      int hashCode()  
      it.unive.lisa.util.numeric.IntInterval indexOf​(Tarsis s)
      Yields the IntInterval containing the minimum and maximum index of s in this.
      boolean isBottom()  
      it.unive.lisa.util.numeric.IntInterval length()
      Yields the IntInterval containing the minimum and maximum length of this abstract value.
      boolean lessOrEqualAux​(Tarsis other)  
      Tarsis lubAux​(Tarsis other)  
      Tarsis repeat​(Interval intv)
      Yields a new Tarsis's instance recognizing each string of this automaton repeated k-times, with k belonging to intv.
      Tarsis replace​(Tarsis search, Tarsis repl)
      Yields the replacement of occurrences of search inside this with repl.
      it.unive.lisa.util.representation.StructuredRepresentation representation()  
      it.unive.lisa.analysis.lattices.Satisfiability satisfiesBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, Tarsis left, Tarsis right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      int size()
      Yields the size of this string, that is, the number of states of the underlying automaton.
      Tarsis substring​(long begin, long end)
      Yields the Tarsis automaton corresponding to the substring of this Tarsis automaton abstract value between two indexes.
      FSA toFSA()
      Converts this domain instance to one of FSA, that uses single characters as transition symbols.
      Tarsis top()  
      Tarsis trim()
      Yields a new Tarsis's instance where trailing and leading whitespaces have been removed from this.
      Tarsis wideningAux​(Tarsis other)  
      • Methods inherited from class java.lang.Object

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

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

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

        isTop
      • Methods inherited from interface it.unive.lisa.analysis.nonrelational.NonRelationalElement

        fixedVariable, unknownVariable
    • Field Detail

      • WIDENING_CAP

        public static final int WIDENING_CAP
        Maximum widening threshold, or default threshold if there is no difference in the size of the two automata.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Tarsis

        public Tarsis()
        Creates a new Tarsis object representing the TOP element.
    • Method Detail

      • lubAux

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

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

        public int size()
        Yields the size of this string, that is, the number of states of the underlying automaton.
        Returns:
        the size of this string
      • wideningAux

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

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

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

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

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

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

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

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

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

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

        public Tarsis evalTernaryExpression​(it.unive.lisa.symbolic.value.operator.ternary.TernaryOperator operator,
                                            Tarsis left,
                                            Tarsis middle,
                                            Tarsis right,
                                            it.unive.lisa.program.cfg.ProgramPoint pp,
                                            it.unive.lisa.analysis.SemanticOracle oracle)
                                     throws it.unive.lisa.analysis.SemanticException
        Specified by:
        evalTernaryExpression in interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<Tarsis>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • satisfiesBinaryExpression

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

        public it.unive.lisa.analysis.lattices.Satisfiability contains​(Tarsis other)
        Semantics of StringContains between this and other.
        Parameters:
        other - the other domain instance
        Returns:
        the satisfiability result
      • substring

        public Tarsis substring​(long begin,
                                long end)
        Yields the Tarsis automaton corresponding to the substring of this Tarsis automaton abstract value between two indexes.
        Parameters:
        begin - where the substring starts
        end - where the substring ends
        Returns:
        the Tarsis automaton corresponding to the substring of this Tarsis automaton between two indexes
      • length

        public it.unive.lisa.util.numeric.IntInterval length()
        Yields the IntInterval containing the minimum and maximum length of this abstract value.
        Returns:
        the minimum and maximum length of this abstract value
      • indexOf

        public it.unive.lisa.util.numeric.IntInterval indexOf​(Tarsis s)
                                                       throws it.unive.lisa.util.datastructures.automaton.CyclicAutomatonException
        Yields the IntInterval containing the minimum and maximum index of s in this.
        Parameters:
        s - the string to be searched
        Returns:
        the minimum and maximum index of s in this
        Throws:
        it.unive.lisa.util.datastructures.automaton.CyclicAutomatonException - when the automaton is cyclic and its language is accessed
      • concat

        public Tarsis concat​(Tarsis other)
        Yields the concatenation between two automata.
        Parameters:
        other - the other automaton
        Returns:
        the concatenation between two automata
      • replace

        public Tarsis replace​(Tarsis search,
                              Tarsis repl)
        Yields the replacement of occurrences of search inside this with repl.
        Parameters:
        search - the domain instance containing the automaton to search
        repl - the domain instance containing the automaton to use as replacement
        Returns:
        the domain instance containing the replaced automaton
      • toFSA

        public FSA toFSA()
        Converts this domain instance to one of FSA, that uses single characters as transition symbols.
        Returns:
        the converted domain instance
      • containsChar

        public it.unive.lisa.analysis.lattices.Satisfiability containsChar​(char c)
                                                                    throws it.unive.lisa.analysis.SemanticException
        Description copied from interface: ContainsCharProvider
        Simplified semantics of the string contains operator, checking a single character is part of the string.
        Specified by:
        containsChar in interface ContainsCharProvider
        Parameters:
        c - the character to check
        Returns:
        whether or not the character is part of the string
        Throws:
        it.unive.lisa.analysis.SemanticException - if something goes wrong during the computation
      • repeat

        public Tarsis repeat​(Interval intv)
                      throws it.unive.lisa.util.numeric.MathNumberConversionException
        Yields a new Tarsis's instance recognizing each string of this automaton repeated k-times, with k belonging to intv.
        Parameters:
        intv - the interval
        Returns:
        a new Tarsis's instance recognizing each string of this automaton repeated k-times, with k belonging to intv
        Throws:
        it.unive.lisa.util.numeric.MathNumberConversionException - if intv is iterated but is not finite
      • trim

        public Tarsis trim()
        Yields a new Tarsis's instance where trailing and leading whitespaces have been removed from this.
        Returns:
        a new Tarsis's instance where trailing and leading whitespaces have been removed from this