public class IndexPropertyList extends AbstractList implements ValueHolder
For performance reasons this implementation does not guarantee that there is no gaps in
the integer ordering sequence (i.e. generally
object.getIndexProperty() != list.indexOf(object)). However it
guarantees the right ordering based on index property.
| Modifier and Type | Field and Description |
|---|---|
protected String |
indexProperty |
protected List |
list
A list used for the actual objects storage.
|
modCount| Constructor and Description |
|---|
IndexPropertyList(String indexProperty)
Creates an empty NumericPropertyOrderedList.
|
IndexPropertyList(String indexProperty,
List objects,
boolean sortNeeded)
Creates a NumericPropertyOrderedList that decorates another list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object element) |
protected int |
calculateIndexValue(int listIndex)
Calculates an index value at the specified list index.
|
Object |
get(int index) |
protected int |
getIndexValue(Object object) |
Object |
getValue()
Returns an object stored by this ValueHolder.
|
Object |
getValueDirectly()
Retrieves ValueHolder value without triggering fault resolution.
|
void |
invalidate()
Turns a ValueHolder into a fault.
|
boolean |
isFault()
Returns true if the internal value is not yet resolved.
|
Object |
remove(int index) |
Object |
set(int index,
Object element) |
protected void |
setIndexValue(Object object,
int index) |
Object |
setValue(Object value)
Sets an object stored by this ValueHolder.
|
Object |
setValueDirectly(Object value)
Sets ValueHolder vaue without triggering fault resolution.
|
protected void |
shift(int startIndex,
int afterIndexValue) |
int |
size() |
protected void |
sort()
Sorts internal list.
|
void |
touch()
Changes list state to "dirty" forcing reordering on next access.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streamprotected List list
protected String indexProperty
public IndexPropertyList(String indexProperty)
public IndexPropertyList(String indexProperty, List objects, boolean sortNeeded)
public boolean isFault()
ValueHolderisFault in interface ValueHolderpublic Object setValueDirectly(Object value) throws CayenneRuntimeException
ValueHoldersetValueDirectly in interface ValueHolderCayenneRuntimeExceptionpublic Object setValue(Object value) throws CayenneRuntimeException
ValueHoldersetValue in interface ValueHoldervalue - a new value of the ValueHolder.CayenneRuntimeExceptionpublic Object getValue() throws CayenneRuntimeException
ValueHoldergetValue in interface ValueHolderCayenneRuntimeExceptionpublic Object getValueDirectly() throws CayenneRuntimeException
ValueHoldergetValueDirectly in interface ValueHolderCayenneRuntimeExceptionpublic void invalidate()
ValueHolderinvalidate in interface ValueHolderpublic void touch()
public Object get(int index)
get in interface Listget in class AbstractListpublic int size()
size in interface Collectionsize in interface Listsize in class AbstractCollectionpublic Object set(int index, Object element)
set in interface Listset in class AbstractListpublic void add(int index,
Object element)
add in interface Listadd in class AbstractListpublic Object remove(int index)
remove in interface Listremove in class AbstractListprotected int calculateIndexValue(int listIndex)
protected int getIndexValue(Object object)
protected void setIndexValue(Object object, int index)
protected void shift(int startIndex,
int afterIndexValue)
protected void sort()
Copyright © 2001–2018 Apache Cayenne. All rights reserved.