|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.Vector | +--AFLPcore.DataList
This is an expandable list that can be used to store objects of type
Data
. The capacity will be increased automatically as needed.
The whole list can be duplicated as well as matched to another list.
Additionally, if all of the elements in the list are of type
SortableData
the list can be searched easily. However,
since the searches are Binary Searches, the list must be kept ordered.
To do this, simply add elemenets using the include
method,
which will keep the list ordered. Finally, even more options are
available by calling methods in the super class, however, these should
only be used if this class does not offer a similar feature.
Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
DataList()
Constructs an empty DataList. |
|
DataList(int capacity)
Constructs an empty DataList with the specified initial capacity. |
|
DataList(int capacity,
int increment)
Constructs an empty DataList with the specified initial capacity and capacity increment. |
Method Summary | |
void |
addData(Data dt)
Adds the specified data to the list. |
DataList |
completeClone()
Creates a new list that is identical to this one with a completely seperate copy of the data in the list. |
void |
copyList(DataList dest)
Copies the data in this list to the specified destination. |
Data |
dataAt(int index)
Retrieve the data at the specified index. |
SearchReturn |
find(double key)
Finds the location of the specified key. |
SortableData |
findNearestUnder(double key)
Gives the SortableData element which is less than or
equal to the given value. |
void |
include(SortableData newData)
Places the given data in the list so that the order of the list is maintained. |
Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
iterator, listIterator, listIterator |
Constructor Detail |
public DataList()
public DataList(int capacity)
capacity
- the initial capacity of the DataList.public DataList(int capacity, int increment)
capacity
- the initial capacity of the DataList.increment
- the amount by which the capacity is increased when
the DataList overflows.Method Detail |
public void addData(Data dt)
dt
- the data to add.public Data dataAt(int index)
index
- the location of the desired data.ArrayIndexOutOfBoundsException
- if the index is not valid.public void include(SortableData newData)
newData
- the data to be added to the listListNotSearchableError
- occurs when the list containes
data that cannot be ordered.public SortableData findNearestUnder(double key)
SortableData
element which is less than or
equal to the given value. All of the data in the list
must be of type SortableData
for this method to work. If
unsortable data has been added to the list, an error will be
thrown. Also, the search algorithm is a binary search, so the
List, must be sorted. Therefore, data should be added with
the includeData
instead of the addData
method.key
- the value to compare tonull
if no such peak exists.ListNotSearchableError
- Given when some of the data is not
ordered and therefor, the list cannot be searched.Data
,
SortableData
,
include(AFLPcore.SortableData)
public SearchReturn find(double key)
SortableData
, which can be ordered, but
simple Data
cannot. If unsortable data has been added to
the list, an error will be thrown. Also, the search algorithm is a
binary search, so the List, must be sorted. Therefore, data
should be added with the include
instead of the
addData
method.key
- the value to search forListNotSearchableError
- Given when some of the data is not
ordered and therefor, the list cannot be searched.Data
,
SortableData
,
include(AFLPcore.SortableData)
public DataList completeClone()
public void copyList(DataList dest)
dest
- the destination list
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |