Class FSA

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

    public class FSA
    extends java.lang.Object
    implements it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<FSA>, ContainsCharProvider
    A class that represent the Finite State Automaton domain for strings, exploiting a SimpleAutomaton.
    • 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_TH
      The parameter used for the widening operator.
      • Fields inherited from interface it.unive.lisa.analysis.Lattice

        BOTTOM_STRING, TOP_STRING
    • Constructor Summary

      Constructors 
      Constructor Description
      FSA()
      Creates a new FSA object representing the TOP element.
      FSA​(SimpleAutomaton a)
      Creates a new FSA object using a SimpleAutomaton.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FSA bottom()  
      FSA concat​(FSA other)
      Yields the concatenation between two automata.
      it.unive.lisa.analysis.lattices.Satisfiability contains​(FSA other)
      Yields if this automaton recognizes strings recognized by the other automaton.
      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)  
      FSA evalBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, FSA left, FSA right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      FSA evalNonNullConstant​(it.unive.lisa.symbolic.value.Constant constant, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      FSA evalTernaryExpression​(it.unive.lisa.symbolic.value.operator.ternary.TernaryOperator operator, FSA left, FSA middle, FSA right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)  
      FSA glbAux​(FSA other)  
      int hashCode()  
      it.unive.lisa.util.numeric.IntInterval indexOf​(FSA 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​(FSA other)  
      FSA lubAux​(FSA other)  
      FSA repeat​(Interval i)
      Yields a new FSA instance recognizing each string of this automaton repeated k-times, with k belonging to intv.
      FSA replace​(FSA search, FSA 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, FSA left, FSA 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.
      FSA substring​(long begin, long end)
      Yields the FSA automaton corresponding to the substring of this FSA automaton abstract value between two indexes.
      FSA top()  
      FSA trim()
      Yields a new FSA where trailing and leading whitespaces have been removed from this.
      FSA wideningAux​(FSA 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_TH

        public static final int WIDENING_TH
        The parameter used for the widening operator.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FSA

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

      • lubAux

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

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

        public FSA wideningAux​(FSA other)
                        throws it.unive.lisa.analysis.SemanticException
        Specified by:
        wideningAux in interface it.unive.lisa.analysis.BaseLattice<FSA>
        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
      • lessOrEqualAux

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

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

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

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

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

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

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

        public FSA 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<FSA>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • evalBinaryExpression

        public FSA evalBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator,
                                        FSA left,
                                        FSA 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<FSA>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • evalTernaryExpression

        public FSA evalTernaryExpression​(it.unive.lisa.symbolic.value.operator.ternary.TernaryOperator operator,
                                         FSA left,
                                         FSA middle,
                                         FSA 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<FSA>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • satisfiesBinaryExpression

        public it.unive.lisa.analysis.lattices.Satisfiability satisfiesBinaryExpression​(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator,
                                                                                        FSA left,
                                                                                        FSA 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<FSA>
        Throws:
        it.unive.lisa.analysis.SemanticException
      • substring

        public FSA substring​(long begin,
                             long end)
                      throws it.unive.lisa.util.datastructures.automaton.CyclicAutomatonException
        Yields the FSA automaton corresponding to the substring of this FSA automaton abstract value between two indexes.
        Parameters:
        begin - where the substring starts
        end - where the substring ends
        Returns:
        the FSA automaton corresponding to the substring of this FSA automaton between two indexes
        Throws:
        it.unive.lisa.util.datastructures.automaton.CyclicAutomatonException - when the automaton is cyclic and its language is accessed
      • 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​(FSA 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 FSA concat​(FSA other)
        Yields the concatenation between two automata.
        Parameters:
        other - the other automaton
        Returns:
        the concatenation between two automata
      • contains

        public it.unive.lisa.analysis.lattices.Satisfiability contains​(FSA other)
        Yields if this automaton recognizes strings recognized by the other automaton.
        Parameters:
        other - the other automaton
        Returns:
        if this automaton recognizes strings recognized by the other automaton
      • replace

        public FSA replace​(FSA search,
                           FSA 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
      • 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
      • trim

        public FSA trim()
        Yields a new FSA where trailing and leading whitespaces have been removed from this.
        Returns:
        a new FSA where trailing and leading whitespaces have been removed from this
      • repeat

        public FSA repeat​(Interval i)
                   throws it.unive.lisa.util.numeric.MathNumberConversionException
        Yields a new FSA instance recognizing each string of this automaton repeated k-times, with k belonging to intv.
        Parameters:
        i - the interval
        Returns:
        a new FSA 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