public abstract class TypeFlow<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected AnalysisContext |
context |
protected AnalysisType |
declaredType |
protected MethodFlowsGraph |
graphRef |
protected int |
id |
boolean |
inQueue |
protected static AtomicInteger |
nextId |
protected T |
source |
protected boolean |
usedAsAParameter
True if this flow is passed as a parameter to a call.
|
protected boolean |
usedAsAReceiver
True if this flow is the receiver of a virtual call.
|
Constructor and Description |
---|
TypeFlow() |
TypeFlow(T source,
AnalysisType declaredType) |
TypeFlow(T source,
AnalysisType declaredType,
TypeState state) |
TypeFlow(TypeFlow<T> original,
MethodFlowsGraph graphRef)
Shallow copy constructor.
|
TypeFlow(TypeState typeState) |
Modifier and Type | Method and Description |
---|---|
void |
addInput(TypeFlow<?> input) |
void |
addObservee(TypeFlow<?> observee) |
void |
addObserver(BigBang bb,
TypeFlow<?> observer)
Register object that will be notified when the state of this flow changes.
|
boolean |
addOriginalObserver(BigBang bb,
TypeFlow<?> observer)
Adds an observer, if not already present, without triggering update.
|
boolean |
addOriginalUse(BigBang bb,
TypeFlow<?> use)
Adds a use, if not already present, without propagating state.
|
boolean |
addState(BigBang bb,
TypeState add) |
boolean |
addState(BigBang bb,
TypeState add,
boolean postFlow) |
boolean |
addUse(BigBang bb,
TypeFlow<?> use) |
boolean |
canSaturate()
Can this type flow saturate? By default all type flows can saturate, with the exception of a
few ones that need to track all their types, e.g., AllInstantiated, AllSynchronized, etc.
|
AnalysisContext |
context() |
TypeFlow<T> |
copy(BigBang bb,
MethodFlowsGraph methodFlows)
By default a type flow is not cloneable.
|
TypeState |
declaredTypeFilter(BigBang bb,
TypeState newState)
Filter type states using a flow's declared type.
|
protected boolean |
doAddUse(BigBang bb,
TypeFlow<?> use,
boolean registerInput) |
boolean |
equals(Object other) |
TypeState |
filter(BigBang bb,
TypeState newState) |
AnalysisType |
getDeclaredType() |
Collection<TypeFlow<?>> |
getInputs() |
Collection<TypeFlow<?>> |
getObservees() |
Collection<TypeFlow<?>> |
getObservers() |
int |
getSlot() |
T |
getSource() |
TypeState |
getState() |
Collection<TypeFlow<?>> |
getUses() |
MethodFlowsGraph |
graphRef() |
int |
hashCode() |
int |
id() |
void |
initClone(BigBang bb)
Initialization code for some clone corner case type flows.
|
boolean |
isAllInstantiated() |
boolean |
isClone() |
boolean |
isCloseToAllInstantiated(BigBang bb) |
boolean |
isSaturated()
Return true if this flow is saturated.
|
boolean |
isUsedAsAParameter() |
boolean |
isUsedAsAReceiver() |
AnalysisMethod |
method() |
protected void |
notifyObservers(BigBang bb)
Let the observers know that the state has changed.
|
protected void |
onInputSaturated(BigBang bb,
TypeFlow<?> input)
Notified by an input that it is saturated and it will stop sending updates.
|
void |
onObservedSaturated(BigBang bb,
TypeFlow<?> observed)
Notified by an observed flow that it is saturated.
|
void |
onObservedUpdate(BigBang bb)
Notify the observer that the observed type flow state has changed.
|
protected void |
onSaturated(BigBang bb)
Called when this type flow becomes saturated.
|
TypeFlow<?> |
receiver()
Some flow have a reciver (e.g., loads, store and invokes).
|
boolean |
removeInput(TypeFlow<?> input) |
boolean |
removeObservee(TypeFlow<?> observee) |
boolean |
removeObserver(TypeFlow<?> observer) |
boolean |
removeUse(TypeFlow<?> use) |
void |
replacedObservedWith(BigBang bb,
TypeFlow<?> newObservedFlow) |
void |
replaceObservedWith(BigBang bb,
AnalysisType newObservedType)
When an "observed -> observer" link is updated the observer needs to be notified as well so
it can update its internal reference.
|
protected void |
setObserved(TypeFlow<?> newObservedFlow)
Set the type flow that this flow is observing.
|
void |
setSaturated()
Mark this flow as saturated.
|
void |
setSlot(int slot) |
void |
setState(BigBang bb,
TypeState state) |
void |
setUsedAsAParameter(boolean usedAsAParameter) |
void |
setUsedAsAReceiver(boolean usedAsAReceiver) |
protected void |
swapOut(BigBang bb,
TypeFlow<?> newFlow)
This flow will swap itself out at all uses and observers.
|
String |
toString() |
void |
update(BigBang bb) |
protected static final AtomicInteger nextId
protected final int id
protected final T source
protected final AnalysisType declaredType
protected final MethodFlowsGraph graphRef
protected final AnalysisContext context
protected boolean usedAsAParameter
protected boolean usedAsAReceiver
public volatile boolean inQueue
public TypeFlow()
public TypeFlow(TypeState typeState)
public TypeFlow(T source, AnalysisType declaredType)
public TypeFlow(T source, AnalysisType declaredType, TypeState state)
public TypeFlow(TypeFlow<T> original, MethodFlowsGraph graphRef)
original
- the original flowgraphRef
- the holder method clonepublic TypeFlow<T> copy(BigBang bb, MethodFlowsGraph methodFlows)
bb
- methodFlows
- public void initClone(BigBang bb)
bb
- public void setUsedAsAParameter(boolean usedAsAParameter)
public boolean isUsedAsAParameter()
public void setUsedAsAReceiver(boolean usedAsAReceiver)
public boolean isUsedAsAReceiver()
public TypeFlow<?> receiver()
public int id()
public AnalysisContext context()
public MethodFlowsGraph graphRef()
public AnalysisMethod method()
public T getSource()
public boolean isClone()
public AnalysisType getDeclaredType()
public TypeState getState()
public boolean isAllInstantiated()
public boolean isCloseToAllInstantiated(BigBang bb)
public void setSlot(int slot)
public int getSlot()
public boolean isSaturated()
public boolean canSaturate()
public void setSaturated()
public boolean addOriginalUse(BigBang bb, TypeFlow<?> use)
public boolean removeUse(TypeFlow<?> use)
public Collection<TypeFlow<?>> getUses()
public boolean addOriginalObserver(BigBang bb, TypeFlow<?> observer)
public void addObserver(BigBang bb, TypeFlow<?> observer)
public boolean removeObserver(TypeFlow<?> observer)
public Collection<TypeFlow<?>> getObservers()
protected void notifyObservers(BigBang bb)
public void addObservee(TypeFlow<?> observee)
public Collection<TypeFlow<?>> getObservees()
public boolean removeObservee(TypeFlow<?> observee)
public void addInput(TypeFlow<?> input)
public Collection<TypeFlow<?>> getInputs()
public boolean removeInput(TypeFlow<?> input)
public TypeState declaredTypeFilter(BigBang bb, TypeState newState)
public void update(BigBang bb)
public void onObservedUpdate(BigBang bb)
protected void onSaturated(BigBang bb)
protected void swapOut(BigBang bb, TypeFlow<?> newFlow)
protected void onInputSaturated(BigBang bb, TypeFlow<?> input)
public void onObservedSaturated(BigBang bb, TypeFlow<?> observed)
public void replaceObservedWith(BigBang bb, AnalysisType newObservedType)
TypeFlow.replacedObservedWith(BigBang, TypeFlow)
can be used for replacing the
observed with a custom type flow.protected void setObserved(TypeFlow<?> newObservedFlow)