com.devnullsoftware.objlist
Interface IndexedData
- public abstract interface IndexedData
If this interface is used for a class, when that class is stored in an
Objlist, the secondary indices specified by these methods will also be stored.
|
Method Summary |
java.lang.String[] |
getIndices()
gets all the secondary indices that this object needs to store |
java.lang.String[] |
getIndices(Objlist list)
gets all the secondary indices that this object needs to store |
void |
updateLists(java.lang.String indexName,
java.lang.String oldKey,
java.lang.String newKey)
Updates secondary indices in lists which store the item. |
getIndices
public java.lang.String[] getIndices()
- gets all the secondary indices that this object needs to store
- Returns:
- an array of Strings, each containing a name of an index which
is also a field of the object.
getIndices
public java.lang.String[] getIndices(Objlist list)
- gets all the secondary indices that this object needs to store
- Parameters:
the - list in which this object is being stored. Acts as a
reverse pointer so that when items in the objects secondary
index fields get changed, it can notify those lists that
store the item to update their index values appropriately.
If this list is already in the object's list of lists, it
will be ignored.- Returns:
- an array of Strings, each containing a name of an index which
is also a field of the object.
updateLists
public void updateLists(java.lang.String indexName,
java.lang.String oldKey,
java.lang.String newKey)
- Updates secondary indices in lists which store the item. Tries to
remove the old value from the secondary index, but will quietly fail
to do this if indexName, oldValue or newValue are null.
If all parameters are null, the routine will try to update the list
with all new values of all secondary indices, leaving the old values
in the list.
This method should be callled when any variable tracked by a secondary
index in a Objlist has changed value. (Therefore, in OO terms, variables
that are tracked by secondary indices should be private to the class
they reside in so that it can make sure this method is called when
they are changed in order to keep the indices correct).
- Parameters:
indexName - the name of the index being updated.oldValue - the old value of this fieldnewValue - the new value of this field