Class TransferResult<V extends AbstractValue<V>,S extends Store<S>>
- java.lang.Object
-
- org.checkerframework.dataflow.analysis.TransferResult<V,S>
-
- Type Parameters:
V- type of the abstract value that is trackedS- the store type used in the analysis
- Direct Known Subclasses:
ConditionalTransferResult,RegularTransferResult
public abstract class TransferResult<V extends AbstractValue<V>,S extends Store<S>> extends java.lang.ObjectTransferResultis used as the result type of the individual transfer functions of aTransferFunction. It always belongs to the result of the individual transfer function for a particularNode, even though thatorg.checkerframework.dataflow.cfg.node.Nodeis not explicitly stored inTransferResult.A
TransferResultconsists of a result value, plus one or more stores. It contains one or two stores (for 'then' and 'else'), and zero or more stores with a cause (TypeMirror).
-
-
Field Summary
Fields Modifier and Type Field Description protected @Nullable java.util.Map<javax.lang.model.type.TypeMirror,S>exceptionalStoresThe stores in case the basic block throws an exception (ornullif the correspondingNodedoes not throw any exceptions).protected @Nullable VresultValueThe abstract value of theNodeassociated with thisTransferResult, ornullif no value has been produced.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTransferResult(@Nullable V resultValue, @Nullable java.util.Map<javax.lang.model.type.TypeMirror,S> exceptionalStores)Create a new TransferResult, givenresultValueandexceptionalStores.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleancontainsTwoStores()Returnstrueif and only if this transfer result contains two stores that are potentially not equal.abstract SgetElseStore()Returns the result store produced if theNodethis result belongs to evaluates tofalse.@Nullable SgetExceptionalStore(javax.lang.model.type.TypeMirror exception)Returns the store that flows along the outgoing exceptional edge labeled withexception(ornullif no special handling is required for exceptional edges).@Nullable java.util.Map<javax.lang.model.type.TypeMirror,S>getExceptionalStores()abstract SgetRegularStore()Returns the regular result store produced if no exception is thrown by theNodecorresponding to this transfer function result.@Nullable VgetResultValue()Returns the abstract value produced by the transfer function,nullotherwise.abstract SgetThenStore()Returns the result store produced if theNodethis result belongs to evaluates totrue.voidsetResultValue(V resultValue)Set the value ofresultValue.abstract booleanstoreChanged()Returnstrueif and only if the transfer function returning this transfer result changed the regularStore, elseStore, or thenStore.
-
-
-
Field Detail
-
resultValue
protected @Nullable V extends AbstractValue<V> resultValue
The abstract value of theNodeassociated with thisTransferResult, ornullif no value has been produced.Is set by
setResultValue(V).
-
exceptionalStores
protected final @Nullable java.util.Map<javax.lang.model.type.TypeMirror,S extends Store<S>> exceptionalStores
The stores in case the basic block throws an exception (ornullif the correspondingNodedoes not throw any exceptions). Does not necessarily contain a store for every exception, in which case the in-store will be used.
-
-
Constructor Detail
-
TransferResult
protected TransferResult(@Nullable V resultValue, @Nullable java.util.Map<javax.lang.model.type.TypeMirror,S> exceptionalStores)
Create a new TransferResult, givenresultValueandexceptionalStores.- Parameters:
resultValue- the abstract value of theNodeassociated with thisTransferResultexceptionalStores- the stores in case the basic block throws an exception (ornullif the correspondingNodedoes not throw any exceptions)
-
-
Method Detail
-
getResultValue
public @Nullable V getResultValue()
Returns the abstract value produced by the transfer function,nullotherwise.- Returns:
- the abstract value produced by the transfer function,
nullotherwise
-
setResultValue
public void setResultValue(V resultValue)
Set the value ofresultValue.- Parameters:
resultValue- the abstract value of theNodeassociated with thisTransferResult
-
getRegularStore
public abstract S getRegularStore()
Returns the regular result store produced if no exception is thrown by theNodecorresponding to this transfer function result.- Returns:
- the regular result store produced if no exception is thrown by the
Nodecorresponding to this transfer function result
-
getThenStore
public abstract S getThenStore()
Returns the result store produced if theNodethis result belongs to evaluates totrue.- Returns:
- the result store produced if the
Nodethis result belongs to evaluates totrue
-
getElseStore
public abstract S getElseStore()
Returns the result store produced if theNodethis result belongs to evaluates tofalse.- Returns:
- the result store produced if the
Nodethis result belongs to evaluates tofalse
-
getExceptionalStore
public @Nullable S getExceptionalStore(javax.lang.model.type.TypeMirror exception)
Returns the store that flows along the outgoing exceptional edge labeled withexception(ornullif no special handling is required for exceptional edges).- Parameters:
exception- an exception type- Returns:
- the store that flows along the outgoing exceptional edge labeled with
exception(ornullif no special handling is required for exceptional edges)
-
getExceptionalStores
public @Nullable java.util.Map<javax.lang.model.type.TypeMirror,S> getExceptionalStores()
- Returns:
- a Map of
TypeMirrortoStore,nullotherwise - See Also:
getExceptionalStore(TypeMirror)
-
containsTwoStores
public abstract boolean containsTwoStores()
Returnstrueif and only if this transfer result contains two stores that are potentially not equal. Note that the resulttruedoes not imply thatgetRegularStorecannot be called (or vice versa forfalse). Rather, it indicates thatgetThenStoreorgetElseStorecan be used to give more precise results. Otherwise, if the result isfalse, then all three methodsgetRegularStore,getThenStore, andgetElseStorereturn equivalent stores.- Returns:
trueif and only if this transfer result contains two stores that are potentially not equal
-
storeChanged
public abstract boolean storeChanged()
Returnstrueif and only if the transfer function returning this transfer result changed the regularStore, elseStore, or thenStore.- Returns:
trueif and only if the transfer function returning this transfer result changed the regularStore, elseStore, or thenStore
-
-