Package org.reactfx.util
Class SparseList<E>
- java.lang.Object
-
- org.reactfx.util.SparseList<E>
-
public final class SparseList<E> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSparseList.AbsentSegment<E>private static classSparseList.PresentSegment<E>private static interfaceSparseList.Segment<E>private static classSparseList.Stats
-
Field Summary
Fields Modifier and Type Field Description private static ToSemigroup<SparseList.Segment<?>,SparseList.Stats>SEGMENT_STATSprivate FingerTree<SparseList.Segment<E>,SparseList.Stats>tree
-
Constructor Summary
Constructors Constructor Description SparseList()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private FingerTree<SparseList.Segment<E>,SparseList.Stats>append(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, SparseList.Segment<E> right)voidclear()java.util.List<E>collect()java.util.List<E>collect(int from, int to)private static <E> FingerTree<SparseList.Segment<E>,SparseList.Stats>emptyTree()java.util.Optional<E>get(int index)(package private) intgetDepth()For testing only.EgetOrThrow(int index)EgetPresent(int presentIndex)intgetPresentCount()intgetPresentCountAfter(int position)intgetPresentCountBefore(int position)intgetPresentCountBetween(int from, int to)javafx.scene.control.IndexRangegetPresentItemsRange()(package private) FingerTree<SparseList.Segment<E>,SparseList.Stats>getTree()For testing only.intindexOfPresentItem(int presentIndex)voidinsert(int position, E elem)voidinsertAll(int position, java.util.Collection<? extends E> elems)voidinsertVoid(int position, int length)booleanisPresent(int index)private FingerTree<SparseList.Segment<E>,SparseList.Stats>join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, java.util.List<SparseList.Segment<E>> middle, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)private FingerTree<SparseList.Segment<E>,SparseList.Stats>join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)private FingerTree<SparseList.Segment<E>,SparseList.Stats>join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, Tuple2<SparseList.Segment<E>,java.lang.Integer> lSuffix, java.util.List<SparseList.Segment<E>> middle, Tuple2<SparseList.Segment<E>,java.lang.Integer> rPrefix, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)private FingerTree<SparseList.Segment<E>,SparseList.Stats>join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, Tuple2<SparseList.Segment<E>,java.lang.Integer> lSuffix, SparseList.Segment<E> middle, Tuple2<SparseList.Segment<E>,java.lang.Integer> rPrefix, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)private intlocationToPosition(int major, int minor)voidremove(int index)voidremove(int from, int to)voidset(int index, E elem)booleansetIfAbsent(int index, E elem)intsize()voidsplice(int from, int to, java.util.Collection<? extends E> elems)voidspliceByVoid(int from, int to, int length)private voidspliceSegments(int from, int to, java.util.List<SparseList.Segment<E>> middle)
-
-
-
Field Detail
-
SEGMENT_STATS
private static final ToSemigroup<SparseList.Segment<?>,SparseList.Stats> SEGMENT_STATS
-
tree
private FingerTree<SparseList.Segment<E>,SparseList.Stats> tree
-
-
Method Detail
-
emptyTree
private static <E> FingerTree<SparseList.Segment<E>,SparseList.Stats> emptyTree()
-
size
public int size()
-
getPresentCount
public int getPresentCount()
-
isPresent
public boolean isPresent(int index)
-
getOrThrow
public E getOrThrow(int index)
-
get
public java.util.Optional<E> get(int index)
-
getPresent
public E getPresent(int presentIndex)
-
getPresentCountBefore
public int getPresentCountBefore(int position)
-
getPresentCountAfter
public int getPresentCountAfter(int position)
-
getPresentCountBetween
public int getPresentCountBetween(int from, int to)
-
indexOfPresentItem
public int indexOfPresentItem(int presentIndex)
-
getPresentItemsRange
public javafx.scene.control.IndexRange getPresentItemsRange()
-
locationToPosition
private int locationToPosition(int major, int minor)
-
collect
public java.util.List<E> collect()
-
collect
public java.util.List<E> collect(int from, int to)
-
clear
public void clear()
-
remove
public void remove(int index)
-
remove
public void remove(int from, int to)
-
set
public void set(int index, E elem)
-
setIfAbsent
public boolean setIfAbsent(int index, E elem)
-
insert
public void insert(int position, E elem)
-
insertAll
public void insertAll(int position, java.util.Collection<? extends E> elems)
-
insertVoid
public void insertVoid(int position, int length)
-
splice
public void splice(int from, int to, java.util.Collection<? extends E> elems)
-
spliceByVoid
public void spliceByVoid(int from, int to, int length)
-
spliceSegments
private void spliceSegments(int from, int to, java.util.List<SparseList.Segment<E>> middle)
-
join
private FingerTree<SparseList.Segment<E>,SparseList.Stats> join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, Tuple2<SparseList.Segment<E>,java.lang.Integer> lSuffix, SparseList.Segment<E> middle, Tuple2<SparseList.Segment<E>,java.lang.Integer> rPrefix, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)
-
join
private FingerTree<SparseList.Segment<E>,SparseList.Stats> join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, Tuple2<SparseList.Segment<E>,java.lang.Integer> lSuffix, java.util.List<SparseList.Segment<E>> middle, Tuple2<SparseList.Segment<E>,java.lang.Integer> rPrefix, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)
-
join
private FingerTree<SparseList.Segment<E>,SparseList.Stats> join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, java.util.List<SparseList.Segment<E>> middle, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)
-
join
private FingerTree<SparseList.Segment<E>,SparseList.Stats> join(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, FingerTree<SparseList.Segment<E>,SparseList.Stats> right)
-
append
private FingerTree<SparseList.Segment<E>,SparseList.Stats> append(FingerTree<SparseList.Segment<E>,SparseList.Stats> left, SparseList.Segment<E> right)
-
getDepth
int getDepth()
For testing only.
-
getTree
FingerTree<SparseList.Segment<E>,SparseList.Stats> getTree()
For testing only.- Returns:
-
-