Package icyllis.modernui.text
Class SpanSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
icyllis.modernui.text.SpanSet<E>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
,SequencedCollection<E>
A cached set of spans. Caches the result of
Spanned.getSpans(int, int, Class, java.util.List)
and then
provides faster access to Spanned.nextSpanTransition(int, int, Class)
.
Fields are public for a convenient direct access (read only).
Note that empty spans are ignored by this class by default.
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getNextTransition
(int start, int limit) Similar toSpanned.nextSpanTransition(int, int, Class)
boolean
hasSpansIntersecting
(int start, int end) Returns true if there are spans intersecting the given interval.boolean
void
recycle()
Removes all internal references to the spans to avoid memory leaks.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll, reversed
-
Field Details
-
mSpanStarts
public int[] mSpanStarts -
mSpanEnds
public int[] mSpanEnds -
mSpanFlags
public int[] mSpanFlags
-
-
Constructor Details
-
SpanSet
-
SpanSet
-
-
Method Details
-
init
- Returns:
- true if non-empty
-
hasSpansIntersecting
public boolean hasSpansIntersecting(int start, int end) Returns true if there are spans intersecting the given interval.- Parameters:
end
- must be strictly greater than start
-
getNextTransition
public int getNextTransition(int start, int limit) Similar toSpanned.nextSpanTransition(int, int, Class)
-
recycle
public void recycle()Removes all internal references to the spans to avoid memory leaks.
-