Package edu.umd.cs.findbugs.ba.deref
Class UnconditionalValueDerefSet
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet
-
public class UnconditionalValueDerefSet extends java.lang.ObjectA set of values unconditionally dereferenced in the future.- Author:
- David Hovemeyer
-
-
Constructor Summary
Constructors Constructor Description UnconditionalValueDerefSet(int numValueNumbersInMethod)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDeref(ValueNumber vn, Location location)Mark a value as being dereferenced at given Location.voidcleanDerefSet(Location location, ValueNumberFrame vnaFrame)voidclearDerefSet(ValueNumber value)Clear the set of dereferences for given ValueNumberjava.util.Set<Location>getDerefLocationSet(ValueNumber vn)Get the set of dereference Locations for given value number.intgetLastUpdateTimestamp()java.util.Set<Location>getUnconditionalDerefLocationSet(ValueNumber vn)Get the set of Locations where given value is guaranteed to be dereferenced.java.util.Set<ValueNumber>getValueNumbersThatAreUnconditionallyDereferenced()booleanisBottom()Is this the bottom value?booleanisEmpty()booleanisSameAs(UnconditionalValueDerefSet otherFact)Return whether or not this dataflow fact is identical to the one given.booleanisTop()Is this the top value?booleanisUnconditionallyDereferenced(ValueNumber vn)Return whether or not the given value number is unconditionally dereferenced.voidmakeSameAs(UnconditionalValueDerefSet source)Make this dataflow fact the same as the given one.voidmergeWith(UnconditionalValueDerefSet fact, ValueNumber skipMe, ValueNumberFactory valueNumberFactory)Merge given dataflow fact into this one.voidretainOnlyTheseValueNumbers(java.util.Collection<ValueNumber> valueNumbers)voidsetDerefSet(ValueNumber vn, java.util.Set<Location> derefSet)Set a value as being unconditionally dereferenced at the given set of locations.voidsetIsBottom()Make this dataflow fact the bottom value.voidsetIsTop()Make this dataflow fact the top value.voidsetLastUpdateTimestamp(int lastUpdateTimestamp)java.lang.StringtoString()voidunionWith(UnconditionalValueDerefSet fact, ValueNumberFactory valueNumberFactory)
-
-
-
Method Detail
-
isBottom
public boolean isBottom()
Is this the bottom value?- Returns:
- true if this is the bottom value, false otherwise
-
setIsBottom
public void setIsBottom()
Make this dataflow fact the bottom value.
-
isTop
public boolean isTop()
Is this the top value?- Returns:
- true if this is the top value, false otherwise
-
setIsTop
public void setIsTop()
Make this dataflow fact the top value.
-
makeSameAs
public void makeSameAs(UnconditionalValueDerefSet source)
Make this dataflow fact the same as the given one.- Parameters:
source- another dataflow fact
-
isSameAs
public boolean isSameAs(UnconditionalValueDerefSet otherFact)
Return whether or not this dataflow fact is identical to the one given.- Parameters:
otherFact- another dataflow fact- Returns:
- true if the other dataflow fact is identical to this one, false otherwise
-
mergeWith
public void mergeWith(UnconditionalValueDerefSet fact, @CheckForNull ValueNumber skipMe, ValueNumberFactory valueNumberFactory)
Merge given dataflow fact into this one. We take the intersection of the unconditional deref value number set, and union the deref locations.- Parameters:
fact- another dataflow factskipMe- TODO
-
unionWith
public void unionWith(UnconditionalValueDerefSet fact, ValueNumberFactory valueNumberFactory)
-
addDeref
public void addDeref(ValueNumber vn, Location location)
Mark a value as being dereferenced at given Location.- Parameters:
vn- the valuelocation- the Location
-
setDerefSet
public void setDerefSet(ValueNumber vn, java.util.Set<Location> derefSet)
Set a value as being unconditionally dereferenced at the given set of locations.- Parameters:
vn- the valuederefSet- the Set of dereference Locations
-
clearDerefSet
public void clearDerefSet(ValueNumber value)
Clear the set of dereferences for given ValueNumber- Parameters:
value- the ValueNumber
-
getDerefLocationSet
public java.util.Set<Location> getDerefLocationSet(ValueNumber vn)
Get the set of dereference Locations for given value number.- Parameters:
vn- the value number- Returns:
- the set of dereference Locations
-
isUnconditionallyDereferenced
public boolean isUnconditionallyDereferenced(ValueNumber vn)
Return whether or not the given value number is unconditionally dereferenced.- Parameters:
vn- the value number- Returns:
- true if the value is unconditionally dereferenced, false otherwise
-
getValueNumbersThatAreUnconditionallyDereferenced
public java.util.Set<ValueNumber> getValueNumbersThatAreUnconditionallyDereferenced()
-
retainOnlyTheseValueNumbers
public void retainOnlyTheseValueNumbers(java.util.Collection<ValueNumber> valueNumbers)
-
getUnconditionalDerefLocationSet
public java.util.Set<Location> getUnconditionalDerefLocationSet(ValueNumber vn)
Get the set of Locations where given value is guaranteed to be dereferenced. (I.e., if non-implicit-exception control paths are followed, one of these locations will be reached).- Parameters:
vn- the value- Returns:
- set of Locations, one of which will definitely be reached if non-implicit-exception control paths are followed
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
cleanDerefSet
public void cleanDerefSet(@CheckForNull Location location, ValueNumberFrame vnaFrame)- Parameters:
location-vnaFrame-
-
setLastUpdateTimestamp
public void setLastUpdateTimestamp(int lastUpdateTimestamp)
- Parameters:
lastUpdateTimestamp- The lastUpdateTimestamp to set.
-
getLastUpdateTimestamp
public int getLastUpdateTimestamp()
- Returns:
- Returns the lastUpdateTimestamp.
-
isEmpty
public boolean isEmpty()
- Returns:
trueif the set is empty
-
-