|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--moka.lang.Object | +--moka.io.Serializable | +--moka.util.SerialList
The SerialList
class implements a serializable
list of serializable elements. Like an array, it contains components that can be
accessed using an integer index. However, the size of a
SerialList
can grow or shrink as needed to accommodate
adding and removing items after the SerialList
has been created.
Each serializable linked lists tries to optimize storage management by reallocating memory every time the size of the array grows or shrinks.
Field Summary | |
int |
size
The actual size of the SerialList. |
Constructor Summary | |
SerialList()
Creates a new SerialList. |
|
SerialList(moka.util.Enumeration enu)
Creates a new SerialList adding the elements of the specified enumeration. |
Method Summary | |
void |
add(int index,
moka.io.Serializable o)
Inserts the specified element at the specified position in this serial list. |
void |
clear()
Removes all of the elements from this linked list. |
boolean |
contains(moka.io.Serializable o)
Returns true if this linked list contains the specified element. |
void |
copyInto(moka.io.Serializable[] anArray,
int fromIndex,
int toIndex)
Copies the components of this linked list into the specified array. |
moka.io.Serializable |
dequeue()
Removes the object at the beginning of this queue and returns that object as the value of this function. |
moka.util.Enumeration |
elements()
Returns an enumeration of the components of this SerialList. |
void |
enqueue(moka.io.Serializable item)
Enqueues an item at the end of this queue. |
void |
finalize()
Frees the memory used by this object. |
moka.io.Serializable |
get(int index)
Returns the element at the specified position in this linked list. |
int |
indexOf(moka.io.Serializable o)
Returns the index in this linked list of the first occurrence of the specified element, or -1 if this list does not contain this element. |
int |
indexOf(moka.io.Serializable elem,
int index)
Searches for the first occurence of the given argument, beginning the search at index . |
int |
lastIndexOf(moka.io.Serializable o)
Returns the index in this linked list of the last occurrence of the specified element, or -1 if this list does not contain this element. |
int |
lastIndexOf(moka.io.Serializable elem,
int index)
Searches backwards for the specified object, starting from the specified index, and returns an index to it. |
moka.io.Serializable |
peek()
Looks at the object at the top of this stack without removing it from the stack. |
moka.io.Serializable |
pop()
Removes the object at the top of this stack and returns that object as the value of this function. |
void |
push(moka.io.Serializable item)
Pushes an item onto the top of this stack. |
moka.io.Serializable |
remove(int index)
Removes the element at the specified position in this linked list. |
boolean |
remove(moka.io.Serializable o)
Removes the first occurrence in this linked list of the specified element. |
moka.io.Serializable |
set(int index,
moka.io.Serializable element)
Replaces the element at the specified position in this linked list with the specified element. |
java.lang.String |
toString()
Returns a string representation of this LinkedList, containing the String representation of each element. |
Methods inherited from class moka.io.Serializable |
deserialize, serialize |
Methods inherited from class moka.lang.Object |
equals, getClassName |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int size
Constructor Detail |
public SerialList()
public SerialList(moka.util.Enumeration enu)
Method Detail |
public moka.util.Enumeration elements()
public void add(int index, moka.io.Serializable o)
index
- index at which the specified element is to be inserted.public void push(moka.io.Serializable item)
item
- the item to be pushed onto this stack.public void enqueue(moka.io.Serializable item)
item
- the item to be enqueued.public void clear()
public void finalize()
finalize
in class Object
public boolean contains(moka.io.Serializable o)
o
- element whose presence in this linked list is to be tested.
public moka.io.Serializable get(int index)
index
- index of element to return.
public int indexOf(moka.io.Serializable o)
o
- element to search for.
public int lastIndexOf(moka.io.Serializable o)
o
- element to search for.
public moka.io.Serializable remove(int index)
index
- the index of the element to removed.
public boolean remove(moka.io.Serializable o)
o
- element to be removed from this linked list, if present.
public moka.io.Serializable peek()
public moka.io.Serializable pop()
public moka.io.Serializable dequeue()
public moka.io.Serializable set(int index, moka.io.Serializable element)
index
- index of element to replace.element
- element to be stored at the specified position.
public void copyInto(moka.io.Serializable[] anArray, int fromIndex, int toIndex)
anArray
- the array into which the components get copied.fromIndex
- the index of the first object in the linked list
to copy.toIndex
- the index after the last object in the linked list
to copy.public int indexOf(moka.io.Serializable elem, int index)
index
.
elem
- an object.index
- the index to start searching from.
index
or later in the
vector or -1
if the object is not
found.public int lastIndexOf(moka.io.Serializable elem, int index)
elem
- the desired component.index
- the index to start searching from.
index
in
the linked list or return -1
if the object is not found.public java.lang.String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |