|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.devnullsoftware.objlist.Objlist
A growable List class that stores Objects and allows searches on both primary and/or secondary indices.
| Field Summary | |
static boolean |
debug
Debug flag. |
(package private) static long |
serialVersionUID
|
| Constructor Summary | |
Objlist()
Creates a new Objlist with a default size of 100. |
|
Objlist(java.lang.Object[] from)
Creates a new Objlist copied from the array passed in. |
|
Objlist(Objlist from)
Creates a new Objlist copied from the Objlist passed in. |
|
| Method Summary | |
java.lang.Object |
add(java.lang.Object obj)
Adds a new Object to the list. |
void |
delete(java.lang.String id)
Deletes an Object from the list. |
protected void |
deleteCurrentIndex()
Deletes the object that is the current index. |
boolean |
deleteObj(java.lang.Object obj)
Deletes an Object from the list. |
java.lang.Object |
find(java.lang.String id)
Finds the Object identified by the string passed in. |
java.lang.Object |
find(java.lang.String key,
java.lang.String indexName)
Finds the object using the secondary index identified by the string passed in. |
int |
findIndex(java.lang.Object obj)
Finds the Index number associated with a particular object. |
java.lang.Object |
first()
Retrieves the first Object from the Objlist. |
int |
firstIndex()
Gives the first index number in the list that contains a valid Object. |
int |
getIndex()
Gets the current Index number. |
int |
getNumItems()
Gets the number of items currently stored in the list. |
java.lang.Object |
index(int Index)
Retrieves Object at the index given. |
java.lang.Object |
last()
Retrieves the last Object stored in the Objlist. |
int |
lastIndex()
Gives the last index number in the list that stores a valid Object. |
java.lang.Object |
next()
Retrieves the next Object from the list. |
java.lang.Object |
next(java.lang.Object obj)
Given an object, finds it in the list and returns the Object that comes after it. |
java.lang.String[] |
orderedStringArray()
Converts the Objects in the list to Strings and puts them in an array of strings. |
java.lang.Object |
overwrite(java.lang.Object obj)
Adds a new Object to the list. |
java.lang.Object |
prev()
Retrieves the previous Object from the list. |
java.lang.Object |
prev(java.lang.Object obj)
Given an object, finds it in the list and returns the Object that comes before it. |
protected void |
setIndex(int newIndex)
Sets the index to the value given. |
java.lang.String[] |
stringArray()
Converts the Objects in the list to Strings and puts them in an array of strings. |
java.lang.String[] |
stringArrayKeys()
Converts the Objects in the list to Strings and puts them in an array of strings. |
void |
updateAllIndices(java.lang.Object obj)
updates all secondary indices for an Object. |
void |
updateIndex(java.lang.Object obj,
java.lang.String indexName,
java.lang.String oldKey,
java.lang.String newKey)
updates secondary index for an Object. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final long serialVersionUID
public static boolean debug
| Constructor Detail |
public Objlist()
public Objlist(Objlist from)
from - Objlist to be copied.public Objlist(java.lang.Object[] from)
from - array to be copied.| Method Detail |
public int getIndex()
public int getNumItems()
protected void setIndex(int newIndex)
newIndex - the new Index # to set the list to.public java.lang.String[] stringArray()
public java.lang.String[] stringArrayKeys()
public java.lang.String[] orderedStringArray()
public java.lang.Object add(java.lang.Object obj)
throws java.lang.NullPointerException,
java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
obj - Object to be put on the list.public java.lang.Object overwrite(java.lang.Object obj)
obj - Object to be put on the list.
public void updateIndex(java.lang.Object obj,
java.lang.String indexName,
java.lang.String oldKey,
java.lang.String newKey)
throws IndexesNotSupportedException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
obj - Object which lists need to be updated for.indexName - index which is being updated.String - oldKey the old value of the field which was used as a keyString - newKey the new value of the field which will be used as a key
public void updateAllIndices(java.lang.Object obj)
throws IndexesNotSupportedException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.IllegalAccessException
obj - Object which lists need to be updated forpublic void delete(java.lang.String id)
id - The id of the Object to be deleted. In the case of Objects
that are not strings, the id is the result of the
Object.toString() method.protected void deleteCurrentIndex()
public boolean deleteObj(java.lang.Object obj)
obj - The Object to be deleted from the list. Note that this does
not destroy the Object, just the list's reference to it.public java.lang.Object index(int Index)
Index - the index number to retrieve the Object frompublic java.lang.Object first()
public int firstIndex()
public java.lang.Object last()
public int lastIndex()
public java.lang.Object next()
public java.lang.Object next(java.lang.Object obj)
obj - the Object to find in the list.public java.lang.Object prev()
public java.lang.Object prev(java.lang.Object obj)
obj - the Object to find in the list.public java.lang.Object find(java.lang.String id)
id - The id of the Object to be deleted. In the case of Objects
that are not strings, the id is the result of the
Object.toString() method.
public java.lang.Object find(java.lang.String key,
java.lang.String indexName)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
key - the secondary key used to look up the item.indexName - the name of the secondary index to use for looking
up the item.public int findIndex(java.lang.Object obj)
obj - The Object to search for.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||