soot.jimple.spark.sets
Class SharedHybridSet

java.lang.Object
  extended by soot.jimple.spark.sets.PointsToSetInternal
      extended by soot.jimple.spark.sets.SharedHybridSet
All Implemented Interfaces:
EqualsSupportingPointsToSet, PointsToSet

public class SharedHybridSet
extends PointsToSetInternal

A shared representation of a points-to set which uses a bit vector + a list of extra elements, an "overflow list", to make adding single elements fast in most cases. The bit vector may be shared by multiple points-to sets, while the overflow list is specific to each points-to set. To facilitate sharing of the bitvectors, there is a "hash table" of all existing bitvectors kept, called BitVectorLookupMap, where the ith element contains a list of all existing bitvectors of cardinality i (i.e. has i one bits).

Author:
Adam Richard

Nested Class Summary
 
Nested classes/interfaces inherited from class soot.jimple.spark.sets.PointsToSetInternal
PointsToSetInternal.P2SetVisitorDefaultTrue, PointsToSetInternal.P2SetVisitorInt
 
Field Summary
static int OVERFLOW_SIZE
           
static int OVERFLOW_THRESHOLD
          The max number of elements allowed in the set before creating a new bitvector for it.
 
Fields inherited from class soot.jimple.spark.sets.PointsToSetInternal
type
 
Constructor Summary
SharedHybridSet(Type type, PAG pag)
           
 
Method Summary
 boolean add(Node n)
          Adds n to this set, returns true if n was not already in this set.
 boolean addAll(PointsToSetInternal other, PointsToSetInternal exclude)
          Adds contents of other minus the contents of exclude into this set; returns true if this set changed.
 boolean contains(Node n)
          When the overflow list overflows, the maximum number of elements that may remain in the overflow list (the rest are moved into the base bit vector)
 boolean forall(P2SetVisitor v)
          Calls v's visit method on all nodes in this set.
static P2SetFactory getFactory()
           
 boolean isEmpty()
          Returns true if this set contains no run-time objects.
 int size()
           
 
Methods inherited from class soot.jimple.spark.sets.PointsToSetInternal
flushNew, getBitMask, getNewSet, getOldSet, getType, hasNonEmptyIntersection, mergeWith, pointsToSetEquals, pointsToSetHashCode, possibleClassConstants, possibleStringConstants, possibleTypes, setType, toString, unFlushNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OVERFLOW_SIZE

public static final int OVERFLOW_SIZE
See Also:
Constant Field Values

OVERFLOW_THRESHOLD

public static final int OVERFLOW_THRESHOLD
The max number of elements allowed in the set before creating a new bitvector for it.

See Also:
Constant Field Values
Constructor Detail

SharedHybridSet

public SharedHybridSet(Type type,
                       PAG pag)
Method Detail

contains

public boolean contains(Node n)
When the overflow list overflows, the maximum number of elements that may remain in the overflow list (the rest are moved into the base bit vector)

Specified by:
contains in class PointsToSetInternal

isEmpty

public boolean isEmpty()
Description copied from interface: PointsToSet
Returns true if this set contains no run-time objects.


add

public boolean add(Node n)
Description copied from class: PointsToSetInternal
Adds n to this set, returns true if n was not already in this set.

Specified by:
add in class PointsToSetInternal

addAll

public boolean addAll(PointsToSetInternal other,
                      PointsToSetInternal exclude)
Description copied from class: PointsToSetInternal
Adds contents of other minus the contents of exclude into this set; returns true if this set changed.

Overrides:
addAll in class PointsToSetInternal

forall

public boolean forall(P2SetVisitor v)
Description copied from class: PointsToSetInternal
Calls v's visit method on all nodes in this set.

Specified by:
forall in class PointsToSetInternal

getFactory

public static final P2SetFactory getFactory()

size

public int size()
Overrides:
size in class PointsToSetInternal