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 class
SparseList.AbsentSegment<E>
private static class
SparseList.PresentSegment<E>
private static interface
SparseList.Segment<E>
private static class
SparseList.Stats
-
Field Summary
Fields Modifier and Type Field Description private static ToSemigroup<SparseList.Segment<?>,SparseList.Stats>
SEGMENT_STATS
private 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)
void
clear()
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) int
getDepth()
For testing only.E
getOrThrow(int index)
E
getPresent(int presentIndex)
int
getPresentCount()
int
getPresentCountAfter(int position)
int
getPresentCountBefore(int position)
int
getPresentCountBetween(int from, int to)
javafx.scene.control.IndexRange
getPresentItemsRange()
(package private) FingerTree<SparseList.Segment<E>,SparseList.Stats>
getTree()
For testing only.int
indexOfPresentItem(int presentIndex)
void
insert(int position, E elem)
void
insertAll(int position, java.util.Collection<? extends E> elems)
void
insertVoid(int position, int length)
boolean
isPresent(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 int
locationToPosition(int major, int minor)
void
remove(int index)
void
remove(int from, int to)
void
set(int index, E elem)
boolean
setIfAbsent(int index, E elem)
int
size()
void
splice(int from, int to, java.util.Collection<? extends E> elems)
void
spliceByVoid(int from, int to, int length)
private void
spliceSegments(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:
-
-