|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.util.ints.AbstractIntCollection
kodkod.util.ints.AbstractIntSet
kodkod.util.ints.IntBitSet
public final class IntBitSet
An implementation of the IntSet interface based on a bit map. An IntBitSet can store only numbers in the half-open range [0..capacity) where capacity is a user-specified value. The implementation will allocated enough bits to explicitly represent all allowed integers; it performs better than a tree set when the stored integers are not clustered.
all i: this.ints | 0 <= i < capacity |
capacity: [0..Integer.MAX_VALUE] |
Constructor Summary | |
---|---|
IntBitSet(int capacity)
Constructs an empty IntBitSet that can store up to capacity elements. |
|
IntBitSet(int capacity,
long[] data)
Constructs an IntBitSet that can store up to capacity elements. |
Method Summary | |
---|---|
boolean |
add(int i)
Adds the given integer to this set if not already present and returns true. |
boolean |
addAll(IntCollection other)
Adds all of the elements in the specified collection to this collection. Returns true if this collection has changed as a result of the call. |
int |
capacity()
Returns the capacity of this int bit set |
int |
ceil(int i)
Returns the smallest element in this set that is greater than or equal to i. |
void |
clear()
Removes all elements from this set. |
IntBitSet |
clone()
Returns a copy of this int bit set. |
boolean |
contains(int i)
Returns true if i is in this set. |
boolean |
containsAll(IntCollection other)
Returns true if this collection contains all of the elements in the specified collection. |
int |
floor(int i)
Returns the largest element in this set that is smaller than or equal to i. |
boolean |
isEmpty()
Returns true if this collection has no elements; otherwise returns false. |
IntIterator |
iterator()
Returns an ascending iterator over all elements in this set. |
IntIterator |
iterator(int from,
int to)
Returns an iterator over the elements of this set that are in the closed range [from..to]. |
int |
max()
Returns the largest element in this set. |
int |
min()
Returns the smallest element in this set. |
boolean |
remove(int i)
Removes the given integer from this set if already present and returns true. |
boolean |
removeAll(IntCollection other)
Removes all of this collection's elements that are also contained in the specified collection. After this call returns, this collection will contain no elements in common with the specified collection. Returns true if this collection has changed as a result of the call. |
boolean |
retainAll(IntCollection other)
Retains only the elements in this collection that are contained in the specified collection. In other words, removes from this collection all of its elements that are not contained in the specified collection. Returns true if this collection has changed as a result of the call. |
int |
size()
Returns the number of elements in this collection. |
Methods inherited from class kodkod.util.ints.AbstractIntSet |
---|
equals, hashCode, toString |
Methods inherited from class kodkod.util.ints.AbstractIntCollection |
---|
toArray, toArray |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface kodkod.util.ints.IntSet |
---|
toArray, toArray |
Constructor Detail |
---|
public IntBitSet(int capacity)
java.lang.IllegalArgumentException
- - capacity < 0no this.ints' && this.capacity' = capacity |
public IntBitSet(int capacity, long[] data)
java.lang.IllegalArgumentException
- - capacity is out of range0 <= capacity < max({i: int | data[i>>>6] & (1L<>>6)+1 > data.length |
Method Detail |
---|
public int min()
min
in interface IntSet
min
in class AbstractIntSet
java.util.NoSuchElementException
- - no this.intsIntSet.min()
public int max()
max
in interface IntSet
max
in class AbstractIntSet
java.util.NoSuchElementException
- - no this.intsIntSet.max()
public int ceil(int i)
ceil
in interface IntSet
IntSet.ceil(int)
public int floor(int i)
floor
in interface IntSet
IntSet.floor(int)
public IntIterator iterator()
iterator
in interface IntCollection
iterator
in interface IntSet
iterator
in class AbstractIntSet
IntSet.iterator()
public IntIterator iterator(int from, int to)
iterator
in interface IntSet
IntSet.iterator(int, int)
public int size()
size
in interface IntCollection
size
in interface IntSet
IntSet.size()
public int capacity()
public boolean contains(int i)
contains
in interface IntCollection
contains
in interface IntSet
contains
in class AbstractIntCollection
IntSet.contains(int)
public boolean add(int i)
add
in interface IntCollection
add
in interface IntSet
add
in class AbstractIntCollection
java.lang.IllegalArgumentException
- - i !in [0..this.capacity)IntSet.add(int)
this.ints' = this.ints + i |
public boolean remove(int i)
remove
in interface IntCollection
remove
in interface IntSet
remove
in class AbstractIntCollection
IntSet.remove(int)
this.ints' = this.ints - i |
public boolean isEmpty()
isEmpty
in interface IntCollection
isEmpty
in interface IntSet
isEmpty
in class AbstractIntCollection
IntCollection.isEmpty()
public boolean containsAll(IntCollection other)
containsAll
in interface IntCollection
containsAll
in interface IntSet
containsAll
in class AbstractIntCollection
IntSet.containsAll(kodkod.util.ints.IntCollection)
public boolean addAll(IntCollection other)
addAll
in interface IntCollection
addAll
in interface IntSet
addAll
in class AbstractIntCollection
IntSet.addAll(kodkod.util.ints.IntCollection)
public boolean retainAll(IntCollection other)
retainAll
in interface IntCollection
retainAll
in interface IntSet
retainAll
in class AbstractIntCollection
IntSet.retainAll(kodkod.util.ints.IntCollection)
public boolean removeAll(IntCollection other)
removeAll
in interface IntCollection
removeAll
in interface IntSet
removeAll
in class AbstractIntCollection
IntSet.removeAll(kodkod.util.ints.IntCollection)
public void clear()
clear
in interface IntCollection
clear
in interface IntSet
clear
in class AbstractIntCollection
IntCollection.clear()
no this.ints' |
public IntBitSet clone()
clone
in interface IntSet
clone
in class AbstractIntSet
IntSet.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |