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, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
protected List list
protected String indexProperty
public IndexPropertyList(String indexProperty)
public IndexPropertyList(String indexProperty, List objects, boolean sortNeeded)
public boolean isFault()
ValueHolder
isFault
in interface ValueHolder
public Object setValueDirectly(Object value) throws CayenneRuntimeException
ValueHolder
setValueDirectly
in interface ValueHolder
CayenneRuntimeException
public Object setValue(Object value) throws CayenneRuntimeException
ValueHolder
setValue
in interface ValueHolder
value
- a new value of the ValueHolder.CayenneRuntimeException
public Object getValue() throws CayenneRuntimeException
ValueHolder
getValue
in interface ValueHolder
CayenneRuntimeException
public Object getValueDirectly() throws CayenneRuntimeException
ValueHolder
getValueDirectly
in interface ValueHolder
CayenneRuntimeException
public void invalidate()
ValueHolder
invalidate
in interface ValueHolder
public void touch()
public Object get(int index)
get
in interface List
get
in class AbstractList
public int size()
size
in interface Collection
size
in interface List
size
in class AbstractCollection
public Object set(int index, Object element)
set
in interface List
set
in class AbstractList
public void add(int index, Object element)
add
in interface List
add
in class AbstractList
public Object remove(int index)
remove
in interface List
remove
in class AbstractList
protected 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–2017 Apache Cayenne. All rights reserved.