Class FSA
- java.lang.Object
-
- it.unive.lisa.analysis.string.fsa.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 aSimpleAutomaton
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
WIDENING_TH
The parameter used for the widening operator.
-
Constructor Summary
Constructors Constructor Description FSA()
Creates a new FSA object representing the TOP element.FSA(SimpleAutomaton a)
Creates a new FSA object using aSimpleAutomaton
.
-
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 theIntInterval
containing the minimum and maximum index ofs
inthis
.boolean
isBottom()
it.unive.lisa.util.numeric.IntInterval
length()
Yields theIntInterval
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 ofthis
automaton repeated k-times, with k belonging tointv
.FSA
replace(FSA search, FSA repl)
Yields the replacement of occurrences ofsearch
insidethis
withrepl
.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 fromthis
.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
-
-
-
-
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.
-
FSA
public FSA(SimpleAutomaton a)
Creates a new FSA object using aSimpleAutomaton
.- Parameters:
a
- theSimpleAutomaton
used for object construction.
-
-
Method Detail
-
lubAux
public FSA lubAux(FSA other) throws it.unive.lisa.analysis.SemanticException
- Specified by:
lubAux
in interfaceit.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 interfaceit.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 interfaceit.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 interfaceit.unive.lisa.analysis.BaseLattice<FSA>
- Throws:
it.unive.lisa.analysis.SemanticException
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfaceit.unive.lisa.analysis.BaseLattice<FSA>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceit.unive.lisa.analysis.BaseLattice<FSA>
- Overrides:
hashCode
in classjava.lang.Object
-
isBottom
public boolean isBottom()
- Specified by:
isBottom
in interfaceit.unive.lisa.analysis.Lattice<FSA>
-
representation
public it.unive.lisa.util.representation.StructuredRepresentation representation()
- Specified by:
representation
in interfaceit.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 interfaceit.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 interfaceit.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 interfaceit.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 interfaceit.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 startsend
- 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 theIntInterval
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 theIntInterval
containing the minimum and maximum index ofs
inthis
.- Parameters:
s
- the string to be searched- Returns:
- the minimum and maximum index of
s
inthis
- 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 ofsearch
insidethis
withrepl
.- Parameters:
search
- the domain instance containing the automaton to searchrepl
- 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 interfaceContainsCharProvider
- 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 fromthis
.- 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 ofthis
automaton repeated k-times, with k belonging tointv
.- Parameters:
i
- the interval- Returns:
- a new FSA instance recognizing each string of
this
automaton repeated k-times, with k belonging tointv
- Throws:
it.unive.lisa.util.numeric.MathNumberConversionException
- ifintv
is iterated but is not finite
-
-