Class InferredValue.InferredPair<T extends InferredValue<T>>
- java.lang.Object
-
- it.unive.lisa.analysis.nonrelational.inference.InferredValue.InferredPair<T>
-
- Type Parameters:
T
- the type ofInferredValue
- All Implemented Interfaces:
BaseLattice<InferredValue.InferredPair<T>>
,Lattice<InferredValue.InferredPair<T>>
,StructuredObject
- Enclosing interface:
- InferredValue<T extends InferredValue<T>>
public static class InferredValue.InferredPair<T extends InferredValue<T>> extends java.lang.Object implements BaseLattice<InferredValue.InferredPair<T>>
A pair of instances ofInferredValue
, representing the result of an evaluation in the form of<inferred value, new execution state>
.
-
-
Field Summary
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description InferredPair(T domain, T inferred, T state)
Builds the pair.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InferredValue.InferredPair<T>
bottom()
Yields the bottom element of this lattice.boolean
equals(java.lang.Object obj)
T
getInferred()
Yields the instance ofInferredValue
representing the inferred value.T
getState()
Yields the instance ofInferredValue
representing the execution state.InferredValue.InferredPair<T>
glbAux(InferredValue.InferredPair<T> other)
Performs the greatest lower bound operation between this lattice element and the given one, assuming that base cases have already been handled.int
hashCode()
boolean
isBottom()
Yieldstrue
if and only if this object represents the bottom of the lattice.boolean
isTop()
Yieldstrue
if and only if this object represents the top of the lattice.boolean
lessOrEqualAux(InferredValue.InferredPair<T> other)
Yieldstrue
if and only if this lattice element is in relation with (usually represented through ≤) the given one, assuming that base cases have already been handled.InferredValue.InferredPair<T>
lubAux(InferredValue.InferredPair<T> other)
Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled.InferredValue.InferredPair<T>
narrowingAux(InferredValue.InferredPair<T> other)
Performs the narrowing operation between this lattice element and the given one, assuming that base cases have already been handled.StructuredRepresentation
representation()
Yields aStructuredRepresentation
of the information contained in this pair.InferredValue.InferredPair<T>
top()
Yields the top element of this lattice.java.lang.String
toString()
InferredValue.InferredPair<T>
wideningAux(InferredValue.InferredPair<T> other)
Performs the widening operation between this lattice element and the given one, assuming that base cases have already been handled.-
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
-
-
-
-
Method Detail
-
getInferred
public T getInferred()
Yields the instance ofInferredValue
representing the inferred value.- Returns:
- the inferred value
-
getState
public T getState()
Yields the instance ofInferredValue
representing the execution state.- Returns:
- the execution state
-
top
public InferredValue.InferredPair<T> top()
Description copied from interface:Lattice
Yields the top element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isTop()
uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isTop()
accordingly to provide a coherent test.- Specified by:
top
in interfaceLattice<T extends InferredValue<T>>
- Returns:
- the top element
-
isTop
public boolean isTop()
Description copied from interface:Lattice
Yieldstrue
if and only if this object represents the top of the lattice. The default implementation of this method uses reference equality betweenthis
and the value returned byLattice.top()
, thus assuming that the top element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.- Specified by:
isTop
in interfaceLattice<T extends InferredValue<T>>
- Returns:
true
if this is the top of the lattice
-
bottom
public InferredValue.InferredPair<T> bottom()
Description copied from interface:Lattice
Yields the bottom element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isBottom()
uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isBottom()
accordingly to provide a coherent test.- Specified by:
bottom
in interfaceLattice<T extends InferredValue<T>>
- Returns:
- the bottom element
-
isBottom
public boolean isBottom()
Description copied from interface:Lattice
Yieldstrue
if and only if this object represents the bottom of the lattice. The default implementation of this method uses reference equality betweenthis
and the value returned byLattice.bottom()
, thus assuming that the bottom element is a singleton. If this is not the case, override this method accordingly to provide a coherent test.- Specified by:
isBottom
in interfaceLattice<T extends InferredValue<T>>
- Returns:
true
if this is the bottom of the lattice
-
lubAux
public InferredValue.InferredPair<T> lubAux(InferredValue.InferredPair<T> other) throws SemanticException
Description copied from interface:BaseLattice
Performs the least upper bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:other
is notnull
other
is neither top nor bottomthis
is neither top nor bottomthis
andother
are not the same object (according both to==
and toObject.equals(Object)
)
- Specified by:
lubAux
in interfaceBaseLattice<T extends InferredValue<T>>
- Parameters:
other
- the other lattice element- Returns:
- the least upper bound between this and other
- Throws:
SemanticException
- if an error occurs during the computation
-
glbAux
public InferredValue.InferredPair<T> glbAux(InferredValue.InferredPair<T> other) throws SemanticException
Description copied from interface:BaseLattice
Performs the greatest lower bound operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:other
is notnull
other
is neither top nor bottomthis
is neither top nor bottomthis
andother
are not the same object (according both to==
and toObject.equals(Object)
)
- Specified by:
glbAux
in interfaceBaseLattice<T extends InferredValue<T>>
- Parameters:
other
- the other lattice element- Returns:
- the greatest lower bound between this and other
- Throws:
SemanticException
- if an error occurs during the computation
-
wideningAux
public InferredValue.InferredPair<T> wideningAux(InferredValue.InferredPair<T> other) throws SemanticException
Description copied from interface:BaseLattice
Performs the widening operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:other
is notnull
other
is neither top nor bottomthis
is neither top nor bottomthis
andother
are not the same object (according both to==
and toObject.equals(Object)
)
BaseLattice.lubAux(BaseLattice)
, and is thus safe for finite lattices and ACC ones.- Specified by:
wideningAux
in interfaceBaseLattice<T extends InferredValue<T>>
- Parameters:
other
- the other lattice element- Returns:
- the widening between this and other
- Throws:
SemanticException
- if an error occurs during the computation
-
narrowingAux
public InferredValue.InferredPair<T> narrowingAux(InferredValue.InferredPair<T> other) throws SemanticException
Description copied from interface:BaseLattice
Performs the narrowing operation between this lattice element and the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:other
is notnull
other
is neither top nor bottomthis
is neither top nor bottomthis
andother
are not the same object (according both to==
and toObject.equals(Object)
)
BaseLattice.glbAux(BaseLattice)
, and is thus safe for finite lattices and DCC ones.- Specified by:
narrowingAux
in interfaceBaseLattice<T extends InferredValue<T>>
- Parameters:
other
- the other lattice element- Returns:
- the narrowing between this and other
- Throws:
SemanticException
- if an error occurs during the computation
-
lessOrEqualAux
public boolean lessOrEqualAux(InferredValue.InferredPair<T> other) throws SemanticException
Description copied from interface:BaseLattice
Yieldstrue
if and only if this lattice element is in relation with (usually represented through ≤) the given one, assuming that base cases have already been handled. In particular, it is guaranteed that:other
is notnull
other
is neither top nor bottomthis
is neither top nor bottomthis
andother
are not the same object (according both to==
and toObject.equals(Object)
)
- Specified by:
lessOrEqualAux
in interfaceBaseLattice<T extends InferredValue<T>>
- Parameters:
other
- the other lattice element- Returns:
true
if and only if that condition holds- Throws:
SemanticException
- if an error occurs during the computation
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceBaseLattice<T extends InferredValue<T>>
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfaceBaseLattice<T extends InferredValue<T>>
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Specified by:
toString
in interfaceBaseLattice<T extends InferredValue<T>>
- Overrides:
toString
in classjava.lang.Object
-
representation
public StructuredRepresentation representation()
Yields aStructuredRepresentation
of the information contained in this pair.- Specified by:
representation
in interfaceStructuredObject
- Returns:
- the representation
-
-