|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.uio.edd.utils.datautils.ExtendableObjectList
public class ExtendableObjectList
Objects of this class is used to store list of objects. The list may be of variable length. The list is zero indexed. Elements cannot be removed; set to null instead. Implementation notes: Maximum length of the list is the maximum length of the datatype int. The actual storage is in arrays. Initially the length is 10, the array is expanded in chunks of 10. Will not scale for long lists. TODO: Demand that the user adds the object type for this. If null, mixed array.
Constructor Summary | |
---|---|
ExtendableObjectList()
Creates a new list object. |
|
ExtendableObjectList(java.lang.Object firstElem)
Creates a new list object. |
|
ExtendableObjectList(java.lang.Object[] newList)
Creates a new list object. |
Method Summary | |
---|---|
int |
addElem(java.lang.Object newElem)
Add a new element to the list. |
int |
addElemUnlessAlreadyThere(java.lang.Object newElem)
Add a new element to the list unless it is already there. |
void |
addObjectArray(java.lang.Object[] newObjectArr)
Adding a full array of objects to the list. |
boolean |
emptyList()
Checks if my list is empty. |
int |
findObject(java.lang.Object objectToBeFound)
Find first occurrences of one specific object from my list. |
java.lang.Object |
getElem(int num)
Return one element from the list. |
int |
getLength()
Find the length of the list. |
int |
getLengthNoNulls()
Find the length of the list when all null objects are excluded. |
java.lang.Object[] |
getList()
Get the full object list held by this object. |
java.lang.Object[] |
getListNoNulls()
Get the full object list held by this object, from which all null elements are removed. |
int |
getNextFree()
Find the place in the list in which the next element will be located. |
boolean |
nullFirstObjectInList(java.lang.Object toBeNulled)
Set to null (that is, as close we get to removal) the first occurrence of one specific object from my list. |
int |
nullObjectsInList(java.lang.Object toBeNulled)
Set to null (that is, as close we get to removal) all occurrences of one specific object from my list. |
java.lang.Object[] |
removeDuplicates()
If there are duplicates in the list, returns a list where all but the first occurrence are set to null. |
java.lang.Object[] |
removeDuplicatesAndNulls()
If there are duplicates in the list, returns a list where all but the first occurrence are removed. |
void |
setElem(int num,
java.lang.Object newValue)
Set an element in the list to a new value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtendableObjectList(java.lang.Object firstElem)
firstElem
- The first element of the list.public ExtendableObjectList()
public ExtendableObjectList(java.lang.Object[] newList)
newList
- An array of objects to be set as mine.Method Detail |
---|
public int addElem(java.lang.Object newElem)
newElem
- The new element.
public int addElemUnlessAlreadyThere(java.lang.Object newElem)
newElem
- The new element.
public java.lang.Object getElem(int num)
num
- The index number of the element to be returned.
public void setElem(int num, java.lang.Object newValue)
num
- The index number of the element to be set.newValue
- The new object.public java.lang.Object[] getList()
public java.lang.Object[] getListNoNulls()
public int nullObjectsInList(java.lang.Object toBeNulled)
toBeNulled
- The object to be nulled.
public boolean nullFirstObjectInList(java.lang.Object toBeNulled)
toBeNulled
- The object to be nulled.
public int findObject(java.lang.Object objectToBeFound)
objectToBeFound
- The object to be found.
public boolean emptyList()
public int getNextFree()
public int getLength()
public int getLengthNoNulls()
public java.lang.Object[] removeDuplicates()
public java.lang.Object[] removeDuplicatesAndNulls()
public void addObjectArray(java.lang.Object[] newObjectArr)
newStringArr
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |