Package org.apache.uima.internal.util
Class OrderedFsSet_array2
java.lang.Object
org.apache.uima.internal.util.OrderedFsSet_array2
- All Implemented Interfaces:
Iterable<TOP>
,Collection<TOP>
,NavigableSet<TOP>
,Set<TOP>
,SortedSet<TOP>
This one not in current use Maybe be put back into service when the array becomes large and it
starts outperforming the other
A set of FSs, ordered using a comparator Not thread-safe, use on single thread only
Use: set-sorted indexes in UIMA
Entries kept in order in 1 big ArrayList
Adds optimized:
- maintain high mark, if >, add to end
- batch adds other than above
-- do when reference needed
-- sort the to be added
- to add to pos p, shift elements in p to higher, insert
shifting optimization:
removes replace element with null
shift until hit null
nullBlock - a group of nulls (free space) together
- might be created by a batch add which
adds a block of space all at once
- might arise from encountering 1 or more "nulls" created
by removes
- id by nullBlockStart (inclusive) and nullBlockEnd (exclusive)
bitset: 1 for avail slot
used to compute move for array copy
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This is used in a particular manner: only used to create iterators over that subset -- no insert/delete -
Field Summary
-
Constructor Summary
ConstructorDescriptionOrderedFsSet_array2
(Comparator<TOP> comparatorWithID, Comparator<TOP> comparatorWithoutID) copy constructor - not currently used (06/2017)OrderedFsSet_array2
(OrderedFsSet_array2 set, boolean isReadOnly) called to make a read-only copy -
Method Summary
Modifier and TypeMethodDescriptionboolean
Note: doesn't implement the return value; always returns true;boolean
addAll
(Collection<? extends TOP> c) static int
binarySearch
(TOP fs, int start, int end, TOP[] _a, int _nullBlockStart, int _nullBlockEnd, Comparator<TOP> _comparatorWithID) At the start, the start and end positions are guaranteed to refer to non-null entries But during operation, lower may refer to "null" entries (upper always non-null)int
ceilingPos
(TOP fs) void
clear()
Comparator
<? super TOP> boolean
boolean
containsAll
(Collection<?> c) first()
int
int
int
boolean
isEmpty()
iterator()
last()
int
pollLast()
void
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a1) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.SortedSet
spliterator
-
Field Details
-
comparatorWithID
-
comparatorWithoutID
-
-
Constructor Details
-
OrderedFsSet_array2
-
OrderedFsSet_array2
copy constructor - not currently used (06/2017)- Parameters:
set
- the original to be copied
-
OrderedFsSet_array2
called to make a read-only copy- Parameters:
set
- -isReadOnly
- -
-
-
Method Details
-
comparator
- Specified by:
comparator
in interfaceSortedSet<TOP>
- See Also:
-
first
-
last
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
toArray
-
toArray
public <T> T[] toArray(T[] a1) -
add
Note: doesn't implement the return value; always returns true; -
processBatch
public void processBatch() -
binarySearch
public static int binarySearch(TOP fs, int start, int end, TOP[] _a, int _nullBlockStart, int _nullBlockEnd, Comparator<TOP> _comparatorWithID) At the start, the start and end positions are guaranteed to refer to non-null entries But during operation, lower may refer to "null" entries (upper always non-null)- Parameters:
fs
- - the fs to search forstart
- the index representing the lower bound (inclusive) to search forend
- the index representing the upper bound (exclusive) to search for_a
- the array_nullBlockStart
- inclusive_nullBlockEnd
- exclusive_comparatorWithID
- -- Returns:
- - the index of the found item, or if not found, the (-index) -1 of the poosition one more than where the item would go
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<TOP>
- Specified by:
containsAll
in interfaceSet<TOP>
- See Also:
-
addAll
-
retainAll
-
removeAll
-
clear
public void clear() -
lower
- Specified by:
lower
in interfaceNavigableSet<TOP>
- See Also:
-
lowerPos
- Parameters:
fs
- element to test- Returns:
- pos of greatest element less that fs or -1 if no such
-
floor
- Specified by:
floor
in interfaceNavigableSet<TOP>
- See Also:
-
floorPos
- Parameters:
fs
- -- Returns:
- -
-
ceiling
- Specified by:
ceiling
in interfaceNavigableSet<TOP>
- See Also:
-
ceilingPos
- Parameters:
fs
- -- Returns:
- -
-
higher
- Specified by:
higher
in interfaceNavigableSet<TOP>
- See Also:
-
higherPos
- Parameters:
fs
- the Feature Structure to use for positioning- Returns:
- the position that's higher
-
pollFirst
- Specified by:
pollFirst
in interfaceNavigableSet<TOP>
- See Also:
-
pollLast
- Specified by:
pollLast
in interfaceNavigableSet<TOP>
- See Also:
-
iterator
-
descendingSet
- Specified by:
descendingSet
in interfaceNavigableSet<TOP>
- See Also:
-
descendingIterator
- Specified by:
descendingIterator
in interfaceNavigableSet<TOP>
- See Also:
-
subSet
public NavigableSet<TOP> subSet(TOP fromElement, boolean fromInclusive, TOP toElement, boolean toInclusive) - Specified by:
subSet
in interfaceNavigableSet<TOP>
- See Also:
-
headSet
- Specified by:
headSet
in interfaceNavigableSet<TOP>
- See Also:
-
tailSet
- Specified by:
tailSet
in interfaceNavigableSet<TOP>
- See Also:
-
subSet
-
headSet
-
tailSet
-
getModificationCount
public int getModificationCount() -
toString
-