|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.multicorebsp.util.LazyCollection<T>
T
- Data typepublic class LazyCollection<T>
Aims for O(1) access on as many collection functions possible.
Field Summary | |
---|---|
protected java.util.ArrayList<java.util.Collection<? extends T>> |
added
Added collections since creation |
protected java.util.Collection<T> |
added_items
Added items since creation |
protected java.util.Collection<T> |
original
Original collection |
protected java.util.ArrayList<java.util.Collection<?>> |
removed
Removed collections since creation |
protected java.util.Collection<T> |
removed_items
Removed items since creation |
Constructor Summary | |
---|---|
LazyCollection(java.util.Collection<T> original)
|
|
LazyCollection(java.util.Collection<T> original,
java.util.Collection<T> addBuffer,
java.util.Collection<T> removeBuffer)
Base constructor. |
Method Summary | ||
---|---|---|
boolean |
add(T e)
Does not fold. |
|
boolean |
addAll(java.util.Collection<? extends T> c)
Does not fold. |
|
void |
clear()
Only clears original and added buffers. |
|
boolean |
contains(java.lang.Object o)
Any removed statements take precedance over added items! O(contains(n)), where contains(n) is the asymptotic running time of a contains operation on the datastructures used and n is the maximum number of elements of all buffers. |
|
boolean |
containsAll(java.util.Collection<?> c)
If an element of c is contained in any of the removed buffers, will fold everything. |
|
void |
foldAll()
Empties all buffers to reconstruct the originals array. |
|
boolean |
isEmpty()
Will fold everything >if removed buffer is nonempty< since duplicates may or may not exist in the datastructure used. |
|
java.util.Iterator<T> |
iterator()
Will fold everything since duplicates may or may not exist in the datastructure used. |
|
boolean |
remove(java.lang.Object o)
|
|
boolean |
removeAll(java.util.Collection<?> c)
Does not fold. |
|
boolean |
retainAll(java.util.Collection<?> c)
Folds everything since retainAll will have to compare every element. |
|
int |
size()
Will fold everything since duplicates may or may not exist in the datastructure used. |
|
java.lang.Object[] |
toArray()
Will fold everything. |
|
|
toArray(U[] a)
Will fold everything. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Field Detail |
---|
protected java.util.Collection<T> original
protected java.util.ArrayList<java.util.Collection<? extends T>> added
protected java.util.ArrayList<java.util.Collection<?>> removed
protected java.util.Collection<T> added_items
protected java.util.Collection<T> removed_items
Constructor Detail |
---|
public LazyCollection(java.util.Collection<T> original) throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public LazyCollection(java.util.Collection<T> original, java.util.Collection<T> addBuffer, java.util.Collection<T> removeBuffer)
original
- Original collection.addBuffer
- Buffer to store added elements in (typically empty)removeBuffer
- Buffer to store removed elements in (typically empty)Method Detail |
---|
public boolean add(T e)
add
in interface java.util.Collection<T>
public boolean addAll(java.util.Collection<? extends T> c)
addAll
in interface java.util.Collection<T>
public void clear()
clear
in interface java.util.Collection<T>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<T>
public void foldAll()
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<T>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<T>
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
iterator
in interface java.util.Collection<T>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<T>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<T>
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<T>
public int size()
size
in interface java.util.Collection<T>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<T>
public <U> U[] toArray(U[] a)
toArray
in interface java.util.Collection<T>
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |