|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList
edu.toronto.cs.util.ArrayMarkedList
public class ArrayMarkedList
ArrayMarkedList
is a extention of List that allows
to mark a position in the list and later go back to it. This is
done by creating a collection that stores the sizes of the
undelying list after each mark. When restore is called, elements
are removed from the list untill it's size is equal to that at
the time of last mark.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
ArrayMarkedList()
Creates a new ArrayMarkedList instance. |
|
ArrayMarkedList(java.util.Collection c)
Creates a new ArrayMarkedList instance given an
initial list. |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object o)
Inserts the specified element at the specified position in this list This operation is not supported |
boolean |
addAll(int index,
java.util.Collection c)
Inserts all of the elements in the specified collection into this list at the specified position (optional operation). |
java.lang.Object |
get(int index)
Returns the element at the specified position in this list. |
int |
getNumMarks()
Returns the number of mark calls up to this point. |
static void |
main(java.lang.String[] args)
|
void |
mark()
Records the current number of assertions. |
java.lang.Object |
remove(int index)
Removes the element at the specified position in this list. |
boolean |
remove(java.lang.Object o)
This operation is not supported |
boolean |
removeAll(java.util.Collection c)
This operation is not supported |
void |
restore()
removes all the marks done after the last mark. |
void |
restore(int level)
if markNumber is the last mark, works like restore () otherwise removes all the asserts done after mark (markNumber +1) together with the mark number (markNumber + 1) |
boolean |
retainAll(java.util.Collection c)
This operation is not supported |
java.lang.Object |
set(int index,
java.lang.Object element)
This operation is not supported |
java.lang.String |
toString()
Prints the list plus the number of marks. |
Methods inherited from class java.util.ArrayList |
---|
add, addAll, clear, clone, contains, ensureCapacity, indexOf, isEmpty, lastIndexOf, removeRange, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, subList, toArray, toArray |
Constructor Detail |
---|
public ArrayMarkedList()
ArrayMarkedList
instance.
public ArrayMarkedList(java.util.Collection c)
ArrayMarkedList
instance given an
initial list.
Method Detail |
---|
public java.lang.String toString()
toString
in class java.util.AbstractCollection
public int getNumMarks()
public void mark()
mark
in interface MarkedList
public void restore()
restore
in interface MarkedList
public void restore(int level)
restore
in interface MarkedList
level
- level on which to restorepublic void add(int index, java.lang.Object o)
add
in interface java.util.List
add
in class java.util.ArrayList
index
- position to insert a new member ato
- an Object
to be insertedpublic boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
addAll
in class java.util.ArrayList
index
- an int
a position where to addc
- a Collection
to add
public java.lang.Object get(int index)
get
in interface java.util.List
get
in class java.util.ArrayList
public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.ArrayList
index
- an int
value
Object
valuepublic boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
remove
in class java.util.ArrayList
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
removeAll
in class java.util.AbstractCollection
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
retainAll
in class java.util.AbstractCollection
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
set
in class java.util.ArrayList
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |