|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet
common.IndexedTreeSetDiff
public class IndexedTreeSetDiff
Implementation of the IndexedSortedSet interface that is represented as a set of differences from an underlying IndexedSortedSet.
An IndexedSetDiff will behave correctly if objects are added to the underlying set after the IndexedSetDiff is created, as long as these objects have not also been added to the IndexedSetDiff (then they would be double-counted). Removing objects from the underlying set may cause an IndexedSetDiff to behave incorrectly, because it may change the indices of elements of the underlying set.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface common.IndexedSet |
---|
IndexedSet.EmptyIndexedSet |
Field Summary |
---|
Fields inherited from interface common.IndexedSet |
---|
EMPTY_INDEXED_SET |
Constructor Summary | |
---|---|
IndexedTreeSetDiff(IndexedSortedSet underlying)
Creates a new IndexedTreeSetDiff with the given underlying IndexedSortedSet. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
|
void |
changeUnderlying()
Changes the underlying IndexedSet so it is equal to this one, and clears the changes in this IndexedSetDiff. |
void |
clearChanges()
Clears the changes in this IndexedSetDiff so it is once again equal to the underlying IndexedSet. |
java.util.Comparator |
comparator()
|
boolean |
contains(java.lang.Object o)
|
java.lang.Object |
first()
|
java.lang.Object |
get(int index)
Returns the object with the specified index in this IndexedSet. |
java.util.Set |
getAdditions()
Returns the set of objects that are in this set and not the underlying set. |
java.util.Set |
getRemovals()
Returns the set of objects that are in the underlying set but not in this set. |
java.util.SortedSet |
headSet(java.lang.Object toElement)
|
int |
indexOf(java.lang.Object o)
Returns the index of the given object in this IndexedSet, or -1 if this IndexedSet does not contain the given object. |
java.util.Iterator |
iterator()
|
java.lang.Object |
last()
|
static void |
main(java.lang.String[] args)
Test program. |
boolean |
remove(java.lang.Object o)
|
int |
size()
|
java.util.SortedSet |
subSet(java.lang.Object fromElement,
java.lang.Object toElement)
|
java.util.SortedSet |
tailSet(java.lang.Object fromElement)
|
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public IndexedTreeSetDiff(IndexedSortedSet underlying)
Method Detail |
---|
public int size()
size
in interface java.util.Collection
size
in interface java.util.Set
size
in class java.util.AbstractCollection
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.Set
iterator
in class java.util.AbstractCollection
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.Set
contains
in class java.util.AbstractCollection
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.Set
add
in class java.util.AbstractCollection
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.Set
remove
in class java.util.AbstractCollection
public java.lang.Object get(int index)
IndexedSet
get
in interface IndexedSet
public int indexOf(java.lang.Object o)
IndexedSet
indexOf
in interface IndexedSet
public java.util.Comparator comparator()
comparator
in interface java.util.SortedSet
public java.lang.Object first()
first
in interface java.util.SortedSet
public java.lang.Object last()
last
in interface java.util.SortedSet
public java.util.SortedSet headSet(java.lang.Object toElement)
headSet
in interface java.util.SortedSet
public java.util.SortedSet tailSet(java.lang.Object fromElement)
tailSet
in interface java.util.SortedSet
public java.util.SortedSet subSet(java.lang.Object fromElement, java.lang.Object toElement)
subSet
in interface java.util.SortedSet
public java.util.Set getAdditions()
getAdditions
in interface SetDiff
public java.util.Set getRemovals()
getRemovals
in interface SetDiff
public void changeUnderlying()
changeUnderlying
in interface SetDiff
public void clearChanges()
clearChanges
in interface SetDiff
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |