|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
org.apache.cayenne.util.IndexPropertyList
public class IndexPropertyList
A List implementation that would maintain its internal ordering based on some object numeric "index" property. When objects are added to the list at a certain index, an "index" property is modified to reflect list order, when objects are removed, their index property is set to the negative number.
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.
| Field Summary | |
|---|---|
protected java.lang.String |
indexProperty
|
protected java.util.List |
list
A list used for the actual objects storage. |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
IndexPropertyList(java.lang.String indexProperty)
Creates an empty NumericPropertyOrderedList. |
|
IndexPropertyList(java.lang.String indexProperty,
java.util.List objects,
boolean sortNeeded)
Creates a NumericPropertyOrderedList that decorates another list. |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object element)
|
protected int |
calculateIndexValue(int listIndex)
Calculates an index value at the specified list index. |
java.lang.Object |
get(int index)
|
protected int |
getIndexValue(java.lang.Object object)
|
java.lang.Object |
getValue()
Returns an object stored by this ValueHolder. |
java.lang.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. |
java.lang.Object |
remove(int index)
|
java.lang.Object |
set(int index,
java.lang.Object element)
|
protected void |
setIndexValue(java.lang.Object object,
int index)
|
java.lang.Object |
setValue(java.lang.Object value)
Sets an object stored by this ValueHolder. |
java.lang.Object |
setValueDirectly(java.lang.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. |
| Methods inherited from class java.util.AbstractList |
|---|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
protected java.util.List list
protected java.lang.String indexProperty
| Constructor Detail |
|---|
public IndexPropertyList(java.lang.String indexProperty)
public IndexPropertyList(java.lang.String indexProperty,
java.util.List objects,
boolean sortNeeded)
| Method Detail |
|---|
public boolean isFault()
ValueHolder
isFault in interface ValueHolder
public java.lang.Object setValueDirectly(java.lang.Object value)
throws CayenneRuntimeException
ValueHolder
setValueDirectly in interface ValueHolderCayenneRuntimeException
public java.lang.Object setValue(java.lang.Object value)
throws CayenneRuntimeException
ValueHolder
setValue in interface ValueHoldervalue - a new value of the ValueHolder.
CayenneRuntimeException
public java.lang.Object getValue()
throws CayenneRuntimeException
ValueHolder
getValue in interface ValueHolderCayenneRuntimeException
public java.lang.Object getValueDirectly()
throws CayenneRuntimeException
ValueHolder
getValueDirectly in interface ValueHolderCayenneRuntimeExceptionpublic void invalidate()
ValueHolder
invalidate in interface ValueHolderpublic void touch()
public java.lang.Object get(int index)
get in interface java.util.Listget in class java.util.AbstractListpublic int size()
size in interface java.util.Collectionsize in interface java.util.Listsize in class java.util.AbstractCollection
public java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listset in class java.util.AbstractList
public void add(int index,
java.lang.Object element)
add in interface java.util.Listadd in class java.util.AbstractListpublic java.lang.Object remove(int index)
remove in interface java.util.Listremove in class java.util.AbstractListprotected int calculateIndexValue(int listIndex)
protected int getIndexValue(java.lang.Object object)
protected void setIndexValue(java.lang.Object object,
int index)
protected void shift(int startIndex,
int afterIndexValue)
protected void sort()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||