com.ashridgetech.prevdb.client
Class NonUniqueIndex

java.lang.Object
  |
  +--com.ashridgetech.prevdb.client.NonUniqueIndex

public class NonUniqueIndex
extends Object

An map from values of one PersistentField to Lists of objects that contain that value. Objects with a null value for the PersistentField are not included in any list, so a call to get(java.lang.Object) with a null value always returns an empty list.

Version:
1.0
Author:
paulb

Constructor Summary
NonUniqueIndex(PersistentField indexedField)
          Creates new NonUniqueIndex.
 
Method Summary
 void add(Persistent obj)
          Add a new Persistent object to this index.
 List get(Object value)
          Get the list of objects with a given value in the indexed field.
 PersistentField getIndexedField()
          Get the PersistentField that is indexed
 void remove(Persistent obj)
          Remove a Persistent object from this index when its value for the field indexed by this index has changed.
 String toString()
           
 void update(Persistent obj, Object oldValue, Object newValue)
          Update a Persistent object's place in this index when its value for the field indexed by this index has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonUniqueIndex

public NonUniqueIndex(PersistentField indexedField)
Creates new NonUniqueIndex.

Parameters:
indexedField - the PersistentField that is indexed
Method Detail

getIndexedField

public PersistentField getIndexedField()
Get the PersistentField that is indexed

Returns:
the PersistentField

get

public List get(Object value)
Get the list of objects with a given value in the indexed field.

Parameters:
value - the indexed field value
Returns:
the unmodifiable List. The contents of this list may change internally, even though the caller cannot modify it. If there are no objects with the value, an empty List is returned.

add

public void add(Persistent obj)
Add a new Persistent object to this index.

Parameters:
obj - the object to add

update

public void update(Persistent obj,
                   Object oldValue,
                   Object newValue)
Update a Persistent object's place in this index when its value for the field indexed by this index has changed.

Parameters:
obj - the object whose field value has changed
oldValue - the value of the field before the change
newValue - the value of the field after the change

remove

public void remove(Persistent obj)
Remove a Persistent object from this index when its value for the field indexed by this index has changed.

Parameters:
obj - the object whose field value has changed

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.