Package org.apache.uima.internal.util
Interface PositiveIntSet
- All Known Implementing Classes:
IntBitSet,IntHashSet,IntSet,PositiveIntSet_impl
public interface PositiveIntSet
An set of non-zero integers, ability to iterate over them (possibly in a sorted way), with O(1)
operations for adding, removing, and testing for contains.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int key) voidadd all elements in this set to the IntVector v as a bulk operationvoidclear()remove all members of the setbooleancontains(int key) intfind(int element) default voidIterate over the positive int set in sort order, and run the consumer on each valueintget(int position) For FSBagIndex low level iterator use DOESN"T WORK WITH INCREMENTING position VALUESbooleanisValid(int position) For FSBagIndex low level iterator useiterator()intFor FSBagIndex low level iterator useintFor FSBagIndex low level iterator useintmoveToNext(int position) For FSBagIndex low level iterator useintmoveToPrevious(int position) For FSBagIndex low level iterator usebooleanremove(int key) intsize()int[]
-
Field Details
-
IS_TRACE_MODE_SWITCH
static final boolean IS_TRACE_MODE_SWITCH- See Also:
-
-
Method Details
-
clear
void clear()remove all members of the set -
contains
boolean contains(int key) - Parameters:
key- -- Returns:
- true if key is in the set
-
add
boolean add(int key) - Parameters:
key- -- Returns:
- true if this set did not already contain the specified element
-
bulkAddTo
add all elements in this set to the IntVector v as a bulk operation- Parameters:
v- - to be added to
-
remove
boolean remove(int key) - Parameters:
key- -- Returns:
- true if the set had this element before the remove
-
size
int size()- Returns:
- number of elements in the set
-
toIntArray
int[] toIntArray()- Returns:
- the set as an arbitrarily ordered int array
-
iterator
IntListIterator iterator()- Returns:
- an iterator (may be ordered or unordered) over the members of the set
-
find
int find(int element) - Parameters:
element- an item which may be in the set- Returns:
- -1 if the item is not in the set, or a position value that can be used with iterators to start at that item.
-
get
int get(int position) For FSBagIndex low level iterator use DOESN"T WORK WITH INCREMENTING position VALUES- Parameters:
position- - get the element at this position. This is for iterator use only, and is not related to any key- Returns:
- the element
-
moveToFirst
int moveToFirst()For FSBagIndex low level iterator use- Returns:
- the position of the first element, or -1;
-
moveToLast
int moveToLast()For FSBagIndex low level iterator use- Returns:
- the position of the last element, or -1;
-
moveToNext
int moveToNext(int position) For FSBagIndex low level iterator use- Parameters:
position- -- Returns:
- the position of the next element, or -1;
-
moveToPrevious
int moveToPrevious(int position) For FSBagIndex low level iterator use- Parameters:
position- -- Returns:
- the position of the next element, or -1;
-
isValid
boolean isValid(int position) For FSBagIndex low level iterator use- Parameters:
position- -- Returns:
- true if the position is between the first and last element inclusive.
-
forAllInts
Iterate over the positive int set in sort order, and run the consumer on each value- Parameters:
v- the consumer to run
-