no.uio.edd.utils.datautils
Class ExtendableStringList

java.lang.Object
  extended by no.uio.edd.utils.datautils.ExtendableObjectList
      extended by no.uio.edd.utils.datautils.ExtendableStringList

public class ExtendableStringList
extends ExtendableObjectList

Author:
oeide_loc For strings. Not yet fully functional.

Constructor Summary
ExtendableStringList()
          Creates a new list object.
ExtendableStringList(java.lang.String firstElem)
          Creates a new list object.
ExtendableStringList(java.lang.String[] newList)
          Creates a new list object.
 
Method Summary
 int addElem(java.lang.String newElem)
          Add a new element to the list.
 int addElemUnlessAlreadyThere(java.lang.String newElem)
          Add a new element to the list unless it is already there.
 void addStringArray(java.lang.String[] newStringArr)
           
 java.lang.String getElem(int num)
          Return one element from the list.
 java.lang.String[] getList()
          Get the full string list held by this object.
 java.lang.String[] getListNoNulls()
          Get the full object list held by this object, from which all null elements are removed.
 java.lang.String[] removeDuplicates()
          If there are duplicates in the list, returns a list where all but the first occurrence are set to null.
 java.lang.String[] removeDuplicatesAndNulls()
          If there are duplicates in the list, returns a list where all but the first occurrence are removed.
 
Methods inherited from class no.uio.edd.utils.datautils.ExtendableObjectList
addElem, addElemUnlessAlreadyThere, addObjectArray, emptyList, findObject, getLength, getLengthNoNulls, getNextFree, nullFirstObjectInList, nullObjectsInList, setElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendableStringList

public ExtendableStringList(java.lang.String firstElem)
Creates a new list object.

Parameters:
firstElem - The first element of the list.

ExtendableStringList

public ExtendableStringList()
Creates a new list object.


ExtendableStringList

public ExtendableStringList(java.lang.String[] newList)
Creates a new list object.

Parameters:
newList - An array of objects to be set as mine.
Method Detail

getList

public java.lang.String[] getList()
Get the full string list held by this object. Will normally include trailing null elements that was never initialised.

Overrides:
getList in class ExtendableObjectList
Returns:

getListNoNulls

public java.lang.String[] getListNoNulls()
Get the full object list held by this object, from which all null elements are removed.

Overrides:
getListNoNulls in class ExtendableObjectList
Returns:

addElem

public int addElem(java.lang.String newElem)
Add a new element to the list.

Parameters:
newElem - The new element.
Returns:
The index given to the new element.

addElemUnlessAlreadyThere

public int addElemUnlessAlreadyThere(java.lang.String newElem)
Add a new element to the list unless it is already there.

Parameters:
newElem - The new element.
Returns:
The index given to the new element. If it is not added, -1 is returned.

addStringArray

public void addStringArray(java.lang.String[] newStringArr)

getElem

public java.lang.String getElem(int num)
Return one element from the list.

Overrides:
getElem in class ExtendableObjectList
Parameters:
num - The index number of the element to be returned.
Returns:

removeDuplicates

public java.lang.String[] removeDuplicates()
Description copied from class: ExtendableObjectList
If there are duplicates in the list, returns a list where all but the first occurrence are set to null. Uses equals to compare. If no duplicates, an identical list is returned.

Overrides:
removeDuplicates in class ExtendableObjectList
Returns:
The list where duplicates are nulled.

removeDuplicatesAndNulls

public java.lang.String[] removeDuplicatesAndNulls()
Description copied from class: ExtendableObjectList
If there are duplicates in the list, returns a list where all but the first occurrence are removed. Uses equals to compare. If no duplicates or nulls, an identical list is returned.

Overrides:
removeDuplicatesAndNulls in class ExtendableObjectList
Returns:
A version of my list without duplicates and nulls.