Class TransferInput<V extends AbstractValue<V>,S extends Store<S>>
- java.lang.Object
-
- org.checkerframework.dataflow.analysis.TransferInput<V,S>
-
- Type Parameters:
V
- type of the abstract value that is trackedS
- the store type used in the analysis
- All Implemented Interfaces:
org.plumelib.util.UniqueId
public class TransferInput<V extends AbstractValue<V>,S extends Store<S>> extends java.lang.Object implements org.plumelib.util.UniqueId
TransferInput
is used as the input type of the individual transfer functions of aForwardTransferFunction
or aBackwardTransferFunction
. It also contains a reference to the node for which the transfer function will be applied.A
TransferInput
contains one or two stores. If two stores are present, one belongs to 'then', and the other to 'else'.
-
-
Field Summary
Fields Modifier and Type Field Description protected Analysis<V,S,?>
analysis
The corresponding analysis class to get intermediate flow results.protected @Nullable S
elseStore
The 'else' result store (ornull
if none is present).protected @Nullable Node
node
The corresponding node.protected @Nullable S
store
protected @Nullable S
thenStore
The 'then' result store (ornull
if none is present).
-
Constructor Summary
Constructors Modifier Constructor Description TransferInput(@Nullable Node n, Analysis<V,S,?> analysis, S s)
Create aTransferInput
, given a store and a node-value mapping.TransferInput(@Nullable Node n, Analysis<V,S,?> analysis, S s1, S s2)
Create aTransferInput
, given two stores and a node-value mapping.protected
TransferInput(TransferInput<V,S> from)
Copy constructor.TransferInput(Node n, Analysis<V,S,?> analysis, TransferResult<V,S> to)
Create aTransferInput
, given aTransferResult
and a node-value mapping.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsTwoStores()
Returnstrue
if and only if this transfer input contains two stores that are potentially not equal.TransferInput<V,S>
copy()
Returns an exact copy of this store.boolean
equals(@Nullable java.lang.Object o)
S
getElseStore()
Returns the result store produced if theNode
this result belongs to evaluates tofalse
.@Nullable Node
getNode()
Returns theNode
for thisTransferInput
.S
getRegularStore()
Returns the regular result store produced if no exception is thrown by theNode
corresponding to this transfer function result.S
getThenStore()
Returns the result store produced if theNode
this result belongs to evaluates totrue
.long
getUid()
@Nullable V
getValueOfSubNode(Node n)
Returns the abstract value of noden
, which is required to be a 'sub-node' (that is, a direct or indirect child) of the node this transfer input is associated with.int
hashCode()
TransferInput<V,S>
leastUpperBound(TransferInput<V,S> other)
Compute the least upper bound of two stores.java.lang.String
toString()
-
-
-
Constructor Detail
-
TransferInput
public TransferInput(Node n, Analysis<V,S,?> analysis, TransferResult<V,S> to)
Create aTransferInput
, given aTransferResult
and a node-value mapping.Aliasing: The stores returned by any methods of
to
will be stored internally and are not allowed to be used elsewhere. Full control of them is transferred to this object.The node-value mapping
nodeValues
is provided by the analysis and is only read from within thisTransferInput
.
-
TransferInput
public TransferInput(@Nullable Node n, Analysis<V,S,?> analysis, S s)
Create aTransferInput
, given a store and a node-value mapping.Aliasing: The store
s
will be stored internally and is not allowed to be used elsewhere. Full control overs
is transferred to this object.The node-value mapping
nodeValues
is provided by the analysis and is only read from within thisTransferInput
.
-
TransferInput
public TransferInput(@Nullable Node n, Analysis<V,S,?> analysis, S s1, S s2)
Create aTransferInput
, given two stores and a node-value mapping.Aliasing: The two stores
s1
ands2
will be stored internally and are not allowed to be used elsewhere. Full control of them is transferred to this object.
-
TransferInput
protected TransferInput(TransferInput<V,S> from)
Copy constructor.- Parameters:
from
- aTransferInput
to copy
-
-
Method Detail
-
getUid
public long getUid(@UnknownInitialization TransferInput<V extends AbstractValue<V>,S extends Store<S>> this)
- Specified by:
getUid
in interfaceorg.plumelib.util.UniqueId
-
getNode
public @Nullable Node getNode()
Returns theNode
for thisTransferInput
.- Returns:
- the
Node
for thisTransferInput
-
getValueOfSubNode
public @Nullable V getValueOfSubNode(Node n)
Returns the abstract value of noden
, which is required to be a 'sub-node' (that is, a direct or indirect child) of the node this transfer input is associated with. Furthermore,n
cannot be a l-value node. Returnsnull
if no value is available.- Parameters:
n
- a node- Returns:
- the abstract value of node
n
, ornull
if no value is available
-
getRegularStore
public S getRegularStore()
Returns the regular result store produced if no exception is thrown by theNode
corresponding to this transfer function result.- Returns:
- the regular result store produced if no exception is thrown by the
Node
corresponding to this transfer function result
-
getThenStore
public S getThenStore()
Returns the result store produced if theNode
this result belongs to evaluates totrue
.- Returns:
- the result store produced if the
Node
this result belongs to evaluates totrue
-
getElseStore
public S getElseStore()
Returns the result store produced if theNode
this result belongs to evaluates tofalse
.- Returns:
- the result store produced if the
Node
this result belongs to evaluates tofalse
-
containsTwoStores
public boolean containsTwoStores()
Returnstrue
if and only if this transfer input contains two stores that are potentially not equal. Note that the resulttrue
does not imply thatgetRegularStore
cannot be called (or vice versa forfalse
). Rather, it indicates thatgetThenStore
orgetElseStore
can be used to give more precise results. Otherwise, if the result isfalse
, then all three methodsgetRegularStore
,getThenStore
, andgetElseStore
return equivalent stores.- Returns:
true
if and only if this transfer input contains two stores that are potentially not equal
-
copy
public TransferInput<V,S> copy()
Returns an exact copy of this store.- Returns:
- an exact copy of this store
-
leastUpperBound
public TransferInput<V,S> leastUpperBound(TransferInput<V,S> other)
Compute the least upper bound of two stores.Important: This method must fulfill the same contract as
leastUpperBound
ofStore
.- Parameters:
other
- a transfer input- Returns:
- the least upper bound of this and
other
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-