Class Tarsis
- java.lang.Object
-
- it.unive.lisa.analysis.string.tarsis.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 aRegexAutomaton
.
-
-
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.
-
Constructor Summary
Constructors Constructor Description Tarsis()
Creates a new Tarsis object representing the TOP element.Tarsis(RegexAutomaton a)
Creates a new FSA object using aSimpleAutomaton
.
-
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 ofStringContains
betweenthis
andother
.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 theRegexAutomaton
backing this domain element.Tarsis
glbAux(Tarsis other)
int
hashCode()
it.unive.lisa.util.numeric.IntInterval
indexOf(Tarsis 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(Tarsis other)
Tarsis
lubAux(Tarsis other)
Tarsis
repeat(Interval intv)
Yields a new Tarsis's instance recognizing each string ofthis
automaton repeated k-times, with k belonging tointv
.Tarsis
replace(Tarsis search, Tarsis 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, 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 ofFSA
, 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 fromthis
.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
-
-
-
-
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.
-
Tarsis
public Tarsis(RegexAutomaton a)
Creates a new FSA object using aSimpleAutomaton
.- Parameters:
a
- theSimpleAutomaton
used for object construction.
-
-
Method Detail
-
getAutomaton
public RegexAutomaton getAutomaton()
Yields theRegexAutomaton
backing this domain element.- Returns:
- the automaton
-
lubAux
public Tarsis lubAux(Tarsis other) throws it.unive.lisa.analysis.SemanticException
- Specified by:
lubAux
in interfaceit.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 interfaceit.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 interfaceit.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 interfaceit.unive.lisa.analysis.BaseLattice<Tarsis>
- Throws:
it.unive.lisa.analysis.SemanticException
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfaceit.unive.lisa.analysis.BaseLattice<Tarsis>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceit.unive.lisa.analysis.BaseLattice<Tarsis>
- Overrides:
hashCode
in classjava.lang.Object
-
bottom
public Tarsis bottom()
- Specified by:
bottom
in interfaceit.unive.lisa.analysis.Lattice<Tarsis>
-
isBottom
public boolean isBottom()
- Specified by:
isBottom
in interfaceit.unive.lisa.analysis.Lattice<Tarsis>
-
representation
public it.unive.lisa.util.representation.StructuredRepresentation representation()
- Specified by:
representation
in interfaceit.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 interfaceit.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 interfaceit.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 interfaceit.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 interfaceit.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 ofStringContains
betweenthis
andother
.- 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 startsend
- 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 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(Tarsis 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 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 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
-
toFSA
public FSA toFSA()
Converts this domain instance to one ofFSA
, 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 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
-
repeat
public Tarsis repeat(Interval intv) throws it.unive.lisa.util.numeric.MathNumberConversionException
Yields a new Tarsis's instance recognizing each string ofthis
automaton repeated k-times, with k belonging tointv
.- Parameters:
intv
- the interval- Returns:
- a new Tarsis's 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
-
trim
public Tarsis trim()
Yields a new Tarsis's instance where trailing and leading whitespaces have been removed fromthis
.- Returns:
- a new Tarsis's instance where trailing and leading whitespaces
have been removed from
this
-
-