public class IntSet extends Object implements PositiveIntSet
Set
interface
for performance reasons, though methods with the same name are equivalent.
This does not implement shorts + offset, like the IntHashSet does
because by the time that might be of interest, we would switch to
IntHashSet to get ~O(1) operations including contains.Constructor and Description |
---|
IntSet()
Creates a new instance of this set.
|
IntSet(int capacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(int element)
Adds the specified int to this set.
|
void |
bulkAddTo(IntVector v)
add all elements in this set to the IntVector v as a bulk operation
|
void |
clear()
remove all members of the set
|
boolean |
contains(int element)
Tests if this set contains the specified element.
|
boolean |
equals(Object o)
Tests if two sets are equal.
|
int |
find(int element) |
int |
get(int n)
Used for FsBagIndex, and internally to compute most positive/neg
|
int |
hashCode() |
int |
indexOf(int element) |
boolean |
isValid(int position)
For FSBagIndex low level iterator use
|
org.apache.uima.internal.util.IntSet.IntSetIterator |
iterator() |
int |
moveToFirst()
For FSBagIndex low level iterator use
|
int |
moveToLast()
For FSBagIndex low level iterator use
|
int |
moveToNext(int position)
For FSBagIndex low level iterator use
|
int |
moveToPrevious(int position)
For FSBagIndex low level iterator use
|
boolean |
remove(int key) |
void |
removeElementAt(int n)
Removes the
n -th element in this set. |
int |
size() |
int[] |
toIntArray() |
String |
toString() |
public IntSet()
public IntSet(int capacity)
capacity
- allocate enough space to hold at least this before expandingpublic boolean add(int element)
add
in interface PositiveIntSet
element
- the integer to be added.true
if this set did not already contain this element,
false
otherwise.public boolean contains(int element)
contains
in interface PositiveIntSet
element
- the element to be tested.true
if the element is contained in this set, false
otherwise.public int find(int element)
find
in interface PositiveIntSet
element
- an item which may be in the setpublic int size()
size
in interface PositiveIntSet
public int get(int n)
get
in interface PositiveIntSet
n
- the positionpublic void removeElementAt(int n)
n
-th element in this set.n
- -public boolean equals(Object o)
public int indexOf(int element)
public void clear()
PositiveIntSet
clear
in interface PositiveIntSet
public boolean remove(int key)
remove
in interface PositiveIntSet
key
- -public org.apache.uima.internal.util.IntSet.IntSetIterator iterator()
iterator
in interface PositiveIntSet
public int moveToFirst()
PositiveIntSet
moveToFirst
in interface PositiveIntSet
public int moveToLast()
PositiveIntSet
moveToLast
in interface PositiveIntSet
public int moveToNext(int position)
PositiveIntSet
moveToNext
in interface PositiveIntSet
position
- -public int moveToPrevious(int position)
PositiveIntSet
moveToPrevious
in interface PositiveIntSet
position
- -public boolean isValid(int position)
PositiveIntSet
isValid
in interface PositiveIntSet
position
- -public void bulkAddTo(IntVector v)
PositiveIntSet
bulkAddTo
in interface PositiveIntSet
v
- - to be added topublic int[] toIntArray()
toIntArray
in interface PositiveIntSet
Copyright © 2006–2024 The Apache Software Foundation. All rights reserved.