com.ibm.wala.util.intset
Class SemiSparseMutableIntSet

java.lang.Object
  extended by com.ibm.wala.util.intset.SemiSparseMutableIntSet
All Implemented Interfaces:
IntSet, MutableIntSet

public class SemiSparseMutableIntSet
extends java.lang.Object
implements MutableIntSet


Constructor Summary
SemiSparseMutableIntSet()
           
SemiSparseMutableIntSet(SemiSparseMutableIntSet set)
           
 
Method Summary
 boolean add(int i)
          Add an integer value to this set.
 boolean addAll(IntSet set)
          Add all members of set to this.
 boolean addAllInIntersection(IntSet other, IntSet filter)
           
 void clear()
          remove all elements from this set
 boolean contains(int i)
           
 boolean containsAny(IntSet set)
           
 void copySet(IntSet set)
          Set the value of this to be the same as the value of set
static SemiSparseMutableIntSet diff(SemiSparseMutableIntSet A, SemiSparseMutableIntSet B)
           
 void foreach(IntSetAction action)
          Invoke an action on each element of the Set
 void foreachExcluding(IntSet X, IntSetAction action)
          Invoke an action on each element of the Set, excluding elements of Set X
 IntSet intersection(IntSet that)
          This implementation must not despoil the original value of "this"
 void intersectWith(IntSet set)
          Interset this with another set.
 IntIterator intIterator()
           
 boolean isEmpty()
           
 boolean isSubset(IntSet that)
           
 int max()
           
 boolean remove(int i)
          Remove an integer from this set.
 SemiSparseMutableIntSet removeAll(SemiSparseMutableIntSet B)
           
 boolean sameValue(IntSet that)
           
 int size()
           
 java.lang.String toString()
           
 IntSet union(IntSet that)
          This implementation must not despoil the original value of "this"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SemiSparseMutableIntSet

public SemiSparseMutableIntSet()

SemiSparseMutableIntSet

public SemiSparseMutableIntSet(SemiSparseMutableIntSet set)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

clear

public void clear()
Description copied from interface: MutableIntSet
remove all elements from this set

Specified by:
clear in interface MutableIntSet

contains

public boolean contains(int i)
Specified by:
contains in interface IntSet
Parameters:
i -
Returns:
true iff this set contains integer i

containsAny

public boolean containsAny(IntSet set)
Specified by:
containsAny in interface IntSet
Returns:
true iff this set contains integer i

intersection

public IntSet intersection(IntSet that)
This implementation must not despoil the original value of "this"

Specified by:
intersection in interface IntSet
Returns:
a new IntSet which is the intersection of this and that

union

public IntSet union(IntSet that)
Description copied from interface: IntSet
This implementation must not despoil the original value of "this"

Specified by:
union in interface IntSet
Returns:
a new IntSet containing all elements of this and that

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IntSet
Returns:
true iff this set is empty

size

public int size()
Specified by:
size in interface IntSet
Returns:
the number of elements in this set

intIterator

public IntIterator intIterator()
Specified by:
intIterator in interface IntSet
Returns:
a perhaps more efficient iterator

foreach

public void foreach(IntSetAction action)
Invoke an action on each element of the Set

Specified by:
foreach in interface IntSet

foreachExcluding

public void foreachExcluding(IntSet X,
                             IntSetAction action)
Invoke an action on each element of the Set, excluding elements of Set X

Specified by:
foreachExcluding in interface IntSet
Parameters:
action -

max

public int max()
        throws java.lang.IllegalStateException
Specified by:
max in interface IntSet
Returns:
maximum integer in this set.
Throws:
java.lang.IllegalStateException

sameValue

public boolean sameValue(IntSet that)
Specified by:
sameValue in interface IntSet
Returns:
true iff this has the same value as that.
Throws:
java.lang.IllegalArgumentException - if that is null

isSubset

public boolean isSubset(IntSet that)
Specified by:
isSubset in interface IntSet
Returns:
true iff this is a subset of that.
Throws:
java.lang.IllegalArgumentException - if that is null

copySet

public void copySet(IntSet set)
             throws java.lang.IllegalArgumentException
Set the value of this to be the same as the value of set

Specified by:
copySet in interface MutableIntSet
Throws:
java.lang.IllegalArgumentException - if set == null

addAll

public boolean addAll(IntSet set)
               throws java.lang.IllegalArgumentException
Add all members of set to this.

Specified by:
addAll in interface MutableIntSet
Returns:
true iff the value of this changes.
Throws:
java.lang.IllegalArgumentException - if set == null

add

public boolean add(int i)
Add an integer value to this set.

Specified by:
add in interface MutableIntSet
Parameters:
i - integer to add
Returns:
true iff the value of this changes.

remove

public boolean remove(int i)
Remove an integer from this set.

Specified by:
remove in interface MutableIntSet
Parameters:
i - integer to remove
Returns:
true iff the value of this changes.

intersectWith

public void intersectWith(IntSet set)
Interset this with another set.

Specified by:
intersectWith in interface MutableIntSet
Parameters:
set -

addAllInIntersection

public boolean addAllInIntersection(IntSet other,
                                    IntSet filter)
Specified by:
addAllInIntersection in interface MutableIntSet
Throws:
java.lang.IllegalArgumentException - if other is null

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

removeAll

public SemiSparseMutableIntSet removeAll(SemiSparseMutableIntSet B)

diff

public static SemiSparseMutableIntSet diff(SemiSparseMutableIntSet A,
                                           SemiSparseMutableIntSet B)