soot.toolkits.scalar
Class BoundedArraySparseSet

java.lang.Object
  |
  +--soot.toolkits.scalar.AbstractFlowSet
        |
        +--soot.toolkits.scalar.AbstractBoundedFlowSet
              |
              +--soot.toolkits.scalar.BoundedArraySparseSet
All Implemented Interfaces:
BoundedFlowSet, FlowSet

public class BoundedArraySparseSet
extends AbstractBoundedFlowSet

Provides an efficient implementation of flowsets, that are usually sparse or nearly full (after being complemented). This is done by storing a flag complemented. When a set is complemented, only the elements, that are not in the full set are stored. Even without the use of "complement()" or "topSet()" this flowSet is well suited for sparse sets.


Field Summary
protected  int modifyCounter
          to be able to report concurrent modifications this integer has to be incremented for every modification of the set
 
Constructor Summary
BoundedArraySparseSet()
          creates a BoundedArraySparseSet without an explicite flow-universe.
BoundedArraySparseSet(FlowUniverse flowUniverse)
          a BoundedArraySparseSet with flowUniverse.
 
Method Summary
 void add(java.lang.Object obj)
          Adds obj to this.
 void clear()
          Sets this FlowSet to the empty set (more generally, the bottom element of the lattice.)
 java.lang.Object clone()
          Clones the current FlowSet.
 void complement(FlowSet dest)
          Complements this BoundedFlowSet, putting the result into dest.
 boolean contains(java.lang.Object obj)
          Returns true if this FlowSet contains obj.
 void copy(FlowSet destFlow)
          Copies the current FlowSet into dest.
 void difference(FlowSet otherFlow, FlowSet destFlow)
          Returns the set difference (this join ~other) of this FlowSet and other, putting result into dest.
 java.lang.Object emptySet()
          returns an empty set, most often more efficient than: ((FlowSet)clone()).clear()
 boolean equals(java.lang.Object otherFlow)
           
 void intersection(FlowSet otherFlow, FlowSet destFlow)
          Returns the intersection (meet) of this FlowSet and other, putting result into dest.
 boolean isEmpty()
          Returns true if this FlowSet is the empty set.
 java.util.Iterator iterator()
          the returned iterator implements the remove()-method.
 void remove(java.lang.Object obj)
          Removes obj from this.
 int size()
          Returns the size of the current FlowSet.
 java.util.List toList()
          Returns an unbacked list of contained objects for this FlowSet.
 void union(FlowSet otherFlow, FlowSet destFlow)
          Returns the union (join) of this FlowSet and other, putting result into dest.
 
Methods inherited from class soot.toolkits.scalar.AbstractBoundedFlowSet
complement, topSet
 
Methods inherited from class soot.toolkits.scalar.AbstractFlowSet
add, difference, intersection, remove, toString, union
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface soot.toolkits.scalar.FlowSet
add, difference, intersection, remove, union
 

Field Detail

modifyCounter

protected int modifyCounter
to be able to report concurrent modifications this integer has to be incremented for every modification of the set

Constructor Detail

BoundedArraySparseSet

public BoundedArraySparseSet()
creates a BoundedArraySparseSet without an explicite flow-universe. although complement(), and topSet() can be called, toList() isEmpty(), size() and equals(o) may yield an exception, if the whole universe was necessary.


BoundedArraySparseSet

public BoundedArraySparseSet(FlowUniverse flowUniverse)
a BoundedArraySparseSet with flowUniverse. While the size of the flowUniverse will be asked in several methods the elements itself are only used in toList().
Thi flowUniverse must be exhaustive. All possible elements must be in it.

Parameters:
flowUniverse - all possible elements.
Method Detail

clone

public java.lang.Object clone()
Description copied from interface: FlowSet
Clones the current FlowSet.

Specified by:
clone in interface FlowSet
Specified by:
clone in class AbstractFlowSet

clear

public void clear()
Description copied from interface: FlowSet
Sets this FlowSet to the empty set (more generally, the bottom element of the lattice.)

Specified by:
clear in interface FlowSet
Overrides:
clear in class AbstractFlowSet

emptySet

public java.lang.Object emptySet()
Description copied from interface: FlowSet
returns an empty set, most often more efficient than: ((FlowSet)clone()).clear()

Specified by:
emptySet in interface FlowSet
Overrides:
emptySet in class AbstractFlowSet

size

public int size()
Description copied from interface: FlowSet
Returns the size of the current FlowSet.

Specified by:
size in interface FlowSet
Specified by:
size in class AbstractFlowSet

isEmpty

public boolean isEmpty()
Description copied from interface: FlowSet
Returns true if this FlowSet is the empty set.

Specified by:
isEmpty in interface FlowSet
Specified by:
isEmpty in class AbstractFlowSet

iterator

public java.util.Iterator iterator()
the returned iterator implements the remove()-method.

Specified by:
iterator in interface FlowSet
Overrides:
iterator in class AbstractFlowSet

toList

public java.util.List toList()
Description copied from interface: FlowSet
Returns an unbacked list of contained objects for this FlowSet.

Specified by:
toList in interface FlowSet
Specified by:
toList in class AbstractFlowSet

complement

public void complement(FlowSet dest)
Description copied from interface: BoundedFlowSet
Complements this BoundedFlowSet, putting the result into dest. dest and this may be the same object.

Specified by:
complement in interface BoundedFlowSet
Overrides:
complement in class AbstractBoundedFlowSet

add

public void add(java.lang.Object obj)
Description copied from interface: FlowSet
Adds obj to this.

Specified by:
add in interface FlowSet
Specified by:
add in class AbstractFlowSet

remove

public void remove(java.lang.Object obj)
Description copied from interface: FlowSet
Removes obj from this.

Specified by:
remove in interface FlowSet
Specified by:
remove in class AbstractFlowSet

union

public void union(FlowSet otherFlow,
                  FlowSet destFlow)
Description copied from interface: FlowSet
Returns the union (join) of this FlowSet and other, putting result into dest. dest, other and this could be the same object.

Specified by:
union in interface FlowSet
Overrides:
union in class AbstractFlowSet

intersection

public void intersection(FlowSet otherFlow,
                         FlowSet destFlow)
Description copied from interface: FlowSet
Returns the intersection (meet) of this FlowSet and other, putting result into dest. dest, other and this could be the same object.

Specified by:
intersection in interface FlowSet
Overrides:
intersection in class AbstractFlowSet

difference

public void difference(FlowSet otherFlow,
                       FlowSet destFlow)
Description copied from interface: FlowSet
Returns the set difference (this join ~other) of this FlowSet and other, putting result into dest. dest, other and this could be the same object.

Specified by:
difference in interface FlowSet
Overrides:
difference in class AbstractFlowSet

contains

public boolean contains(java.lang.Object obj)
Description copied from interface: FlowSet
Returns true if this FlowSet contains obj.

Specified by:
contains in interface FlowSet
Specified by:
contains in class AbstractFlowSet

equals

public boolean equals(java.lang.Object otherFlow)
Overrides:
equals in class AbstractFlowSet

copy

public void copy(FlowSet destFlow)
Description copied from interface: FlowSet
Copies the current FlowSet into dest.

Specified by:
copy in interface FlowSet
Overrides:
copy in class AbstractFlowSet