public final class SortedList<E> extends TransformationList<E,E>
TransformationList
Type | Property and Description |
---|---|
<any> |
comparator
The comparator that denotes the order of this SortedList.
|
Modifier and Type | Class and Description |
---|---|
private static class |
SortedList.Element<E> |
private static class |
SortedList.ElementComparator<E> |
Modifier and Type | Field and Description |
---|---|
private <any> |
comparator
The comparator that denotes the order of this SortedList.
|
private java.util.Comparator<SortedList.Element<E>> |
elementComparator |
private SortHelper |
helper |
private int[] |
perm |
private int |
size |
private SortedList.Element<E>[] |
sorted |
private SortedList.Element<E> |
tempElement |
Constructor and Description |
---|
SortedList(<any> source)
Constructs a new unordered SortedList wrapper around the source list.
|
SortedList(<any> source,
java.util.Comparator<? super E> comparator)
Creates a new SortedList wrapped around the source list.
|
Modifier and Type | Method and Description |
---|---|
private void |
addRemove(<any> c) |
<any> |
comparatorProperty()
The comparator that denotes the order of this SortedList.
|
private void |
doSortWithPermutationChange() |
private void |
ensureSize(int size) |
private int |
findPosition(E e) |
E |
get(int index)
Returns the element at the specified position in this list.
|
java.util.Comparator<? super E> |
getComparator()
Gets the value of the property comparator.
|
int |
getSourceIndex(int index)
Maps the index of this list's element to an index in the direct source list.
|
int |
getViewIndex(int index)
Maps the index of the direct source list's element to an index in this list.
|
private void |
insertToMapping(E e,
int idx) |
private void |
removeAllFromMapping() |
private void |
removeFromMapping(int idx,
E e) |
private void |
setAllToMapping(java.util.List<? extends E> list,
int to) |
void |
setComparator(java.util.Comparator<? super E> comparator)
Sets the value of the property comparator.
|
int |
size()
Returns the number of elements in this list.
|
protected void |
sourceChanged(<any> c)
Called when a change from the source is triggered.
|
private void |
update(<any> c) |
private void |
updateIndices(int from,
int viewFrom,
int difference) |
private void |
updatePermutationIndexes(<any> change) |
private void |
updateUnsorted(<any> c) |
getSource, getSourceIndexFor, isInTransformationChain
public final <any> comparatorProperty
getComparator()
,
setComparator(Comparator)
private java.util.Comparator<SortedList.Element<E>> elementComparator
private SortedList.Element<E>[] sorted
private int[] perm
private int size
private final SortHelper helper
private final SortedList.Element<E> tempElement
private <any> comparator
public SortedList(<any> source, java.util.Comparator<? super E> comparator)
source
- a list to wrapcomparator
- a comparator to use or null for unordered Listpublic SortedList(<any> source)
source
- the source list#SortedList(javafx.collections.ObservableList, java.util.Comparator)
protected void sourceChanged(<any> c)
TransformationList
sourceChanged
in class TransformationList<E,E>
c
- the changepublic final <any> comparatorProperty()
getComparator()
,
setComparator(Comparator)
public final java.util.Comparator<? super E> getComparator()
public final void setComparator(java.util.Comparator<? super E> comparator)
public E get(int index)
index
- index of the element to returnjava.lang.IndexOutOfBoundsException
public int size()
private void doSortWithPermutationChange()
public int getSourceIndex(int index)
TransformationList
getSourceIndex
in class TransformationList<E,E>
index
- the index in this listTransformationList.getSource()
public int getViewIndex(int index)
TransformationList
getViewIndex
in class TransformationList<E,E>
index
- the index in the source listTransformationList.getSource()
,
TransformationList.getSourceIndex(int)
private void updatePermutationIndexes(<any> change)
private void updateUnsorted(<any> c)
private void ensureSize(int size)
private void updateIndices(int from, int viewFrom, int difference)
private int findPosition(E e)
private void insertToMapping(E e, int idx)
private void setAllToMapping(java.util.List<? extends E> list, int to)
private void removeFromMapping(int idx, E e)
private void removeAllFromMapping()
private void update(<any> c)
private void addRemove(<any> c)