public class Set_BitSet extends BitSet implements ISet
Constructor and Description |
---|
Set_BitSet(int nbits) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(int element)
Add element to the set
Does not guaranty there is no duplications
|
void |
clear()
Remove all elements from the set
|
boolean |
contain(int element)
Test the existence of element in the set
|
int |
getFirstElement() |
int |
getMaxSize()
Gets the maximum size of the set, or -1 if it is unbounded.
|
int |
getNextElement()
enables to iterate over the set
should be used as follow :
for(int i=getFirstElement(); i>=0; i = getNextElement()){
...
}
The use of getFirstElement() is necessary to ensure a complete iteration
WARNING cannot encapsulate two for loops (copy the set for that)
|
SetType |
getSetType() |
int |
getSize() |
boolean |
isEmpty() |
boolean |
remove(int element)
Remove the first occurence of element from the set
|
int[] |
toArray()
Copies the set in an array if integers
|
and, andNot, cardinality, clear, clear, clone, equals, flip, flip, get, get, hashCode, intersects, length, nextClearBit, nextSetBit, or, previousClearBit, previousSetBit, set, set, set, set, size, toByteArray, toLongArray, toString, valueOf, valueOf, valueOf, valueOf, xor
public boolean add(int element)
ISet
public boolean remove(int element)
ISet
public boolean contain(int element)
ISet
public boolean isEmpty()
public int getSize()
public int getFirstElement()
getFirstElement
in interface ISet
public int getNextElement()
ISet
getNextElement
in interface ISet
public void clear()
ISet
public SetType getSetType()
getSetType
in interface ISet
public int[] toArray()
ISet
public int getMaxSize()
ISet
getMaxSize
in interface ISet
Copyright © 2015. All rights reserved.