Package org.reactfx.collection
Class MemoizationListImpl<E>
- java.lang.Object
-
- org.reactfx.ObservableBase<LiveList.Observer<? super E,?>,QuasiListChange<? extends E>>
-
- org.reactfx.collection.LiveListBase<E>
-
- org.reactfx.collection.MemoizationListImpl<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,javafx.beans.Observable
,javafx.collections.ObservableList<E>
,AccessorListMethods<E>
,LiveList<E>
,MemoizationList<E>
,ProperLiveList<E>
,UnmodifiableByDefaultList<E>
,UnmodifiableByDefaultLiveList<E>
,Observable<LiveList.Observer<? super E,?>>
,ProperObservable<LiveList.Observer<? super E,?>,QuasiListChange<? extends E>>
class MemoizationListImpl<E> extends LiveListBase<E> implements MemoizationList<E>, UnmodifiableByDefaultLiveList<E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
MemoizationListImpl.MemoizedView
-
Nested classes/interfaces inherited from interface org.reactfx.collection.LiveList
LiveList.Observer<E,O>, LiveList.QuasiChangeObserver<E>, LiveList.QuasiModificationObserver<E>
-
-
Field Summary
Fields Modifier and Type Field Description private MemoizationListImpl.MemoizedView
memoizedItems
private javafx.collections.ObservableList<E>
source
private SparseList<E>
sparseList
-
Constructor Summary
Constructors Constructor Description MemoizationListImpl(javafx.collections.ObservableList<E> source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
force(int from, int to)
void
forget(int from, int to)
E
get(int index)
java.util.Optional<E>
getIfMemoized(int index)
int
getMemoizedCount()
int
getMemoizedCountAfter(int position)
int
getMemoizedCountBefore(int position)
javafx.scene.control.IndexRange
getMemoizedItemsRange()
int
indexOfMemoizedItem(int index)
boolean
isMemoized(int index)
LiveList<E>
memoizedItems()
protected Subscription
observeInputs()
Starts observing this observable's input(s), if any.int
size()
private void
sourceChanged(QuasiListChange<? extends E> qc)
-
Methods inherited from class org.reactfx.ObservableBase
addObserver, enqueueNotifications, equals, forEachObserver, getObserverCount, hashCode, isObservingInputs, newObserver, notifyObservers, notifyObservers, observe, removeObserver, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.reactfx.collection.AccessorListMethods
contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, subList, toArray, toArray
-
Methods inherited from interface org.reactfx.collection.LiveList
addChangeObserver, addListener, addListener, addModificationObserver, addQuasiChangeObserver, addQuasiModificationObserver, changes, collapse, collapseDynamic, map, mapDynamic, memoize, modifications, observeChanges, observeModifications, observeQuasiChanges, observeQuasiModifications, pin, quasiChanges, quasiModifications, reduce, reduceRange, removeChangeObserver, removeListener, removeListener, removeModificationObserver, removeQuasiChangeObserver, removeQuasiModificationObserver, sizeProperty, suspendable
-
Methods inherited from interface org.reactfx.Observable
addObserver, observe, removeObserver
-
Methods inherited from interface org.reactfx.collection.ProperLiveList
contentReplacement, defaultEquals, defaultHashCode, defaultNotificationAccumulator, defaultToString, fireContentReplacement, fireElemInsertion, fireElemRemoval, fireElemReplacement, fireModification, fireRangeInsertion, fireRemoveRange
-
Methods inherited from interface org.reactfx.ProperObservable
notifyObservers
-
-
-
-
Field Detail
-
sparseList
private final SparseList<E> sparseList
-
memoizedItems
private final MemoizationListImpl.MemoizedView memoizedItems
-
source
private final javafx.collections.ObservableList<E> source
-
-
Constructor Detail
-
MemoizationListImpl
MemoizationListImpl(javafx.collections.ObservableList<E> source)
-
-
Method Detail
-
observeInputs
protected Subscription observeInputs()
Description copied from class:ObservableBase
Starts observing this observable's input(s), if any. This method is called when the number of observers goes from 0 to 1. This method is called beforeObservableBase.newObserver(Object)
is called for the first observer.- Specified by:
observeInputs
in classObservableBase<LiveList.Observer<? super E,?>,QuasiListChange<? extends E>>
- Returns:
- subscription used to stop observing inputs. The subscription is unsubscribed (i.e. input observation stops) when the number of observers goes down to 0.
-
sourceChanged
private void sourceChanged(QuasiListChange<? extends E> qc)
-
force
public void force(int from, int to)
- Specified by:
force
in interfaceMemoizationList<E>
-
size
public int size()
-
memoizedItems
public LiveList<E> memoizedItems()
- Specified by:
memoizedItems
in interfaceMemoizationList<E>
-
isMemoized
public boolean isMemoized(int index)
- Specified by:
isMemoized
in interfaceMemoizationList<E>
-
getIfMemoized
public java.util.Optional<E> getIfMemoized(int index)
- Specified by:
getIfMemoized
in interfaceMemoizationList<E>
-
getMemoizedCountBefore
public int getMemoizedCountBefore(int position)
- Specified by:
getMemoizedCountBefore
in interfaceMemoizationList<E>
-
getMemoizedCountAfter
public int getMemoizedCountAfter(int position)
- Specified by:
getMemoizedCountAfter
in interfaceMemoizationList<E>
-
getMemoizedCount
public int getMemoizedCount()
- Specified by:
getMemoizedCount
in interfaceMemoizationList<E>
-
forget
public void forget(int from, int to)
- Specified by:
forget
in interfaceMemoizationList<E>
-
indexOfMemoizedItem
public int indexOfMemoizedItem(int index)
- Specified by:
indexOfMemoizedItem
in interfaceMemoizationList<E>
-
getMemoizedItemsRange
public javafx.scene.control.IndexRange getMemoizedItemsRange()
- Specified by:
getMemoizedItemsRange
in interfaceMemoizationList<E>
-
-