@StoreNotUseStandardSerialization @StorableClass public class TreeSupport<E> extends Object implements ISupportListenable<E>, Cloneable, Iterable<E>, Serializable
Modifier and Type | Field and Description |
---|---|
protected boolean |
concurrentAccess |
protected IInstanceFactory |
instanceFactory |
protected int |
modificationCount |
protected RedBlackTree<E> |
tree
not transient for persistence
|
Modifier | Constructor and Description |
---|---|
|
TreeSupport(boolean manageNodeIndex,
boolean concurrentAccess) |
|
TreeSupport(Comparator<? super E> comparator,
boolean manageNodeIndex,
boolean concurrentAccess) |
protected |
TreeSupport(Comparator<? super E> comparator,
boolean manageNodeIndex,
boolean uniqueValue,
boolean concurrentAccess) |
protected |
TreeSupport(IInstanceFactory instanceFactory,
boolean manageNodeIndex,
boolean concurrentAccess) |
protected |
TreeSupport(IInstanceFactory instanceFactory,
Comparator<? super E> comparator,
boolean manageNodeIndex,
boolean concurrentAccess) |
protected |
TreeSupport(IInstanceFactory instanceFactory,
Comparator<? super E> comparator,
boolean manageNodeIndex,
boolean uniqueValue,
boolean concurrentAccess) |
Modifier and Type | Method and Description |
---|---|
void |
add(E element) |
protected void |
addAll(TreeSupport<E> list)
protected for persistence constraint
|
E |
addReplace(E element) |
protected void |
appended(TreeSupportNode<E> nodeAppended) |
void |
clear() |
TreeSupport<E> |
clone() |
E |
closestGreaterOrEqual(E element) |
IRBTNode<E> |
closestGreaterOrEqualNode(E element) |
E |
closestLessOrEqual(E element) |
IRBTNode<E> |
closestLessOrEqualNode(E element) |
Comparator<? super E> |
comparator() |
ListIterator<E> |
descendingIterator() |
ListIterator<E> |
descendingIterator(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
sublist of this list descending iterator
|
E |
elementAtIndex(int index) |
protected void |
fireAdded(IRBTNode<E> toAdd) |
protected void |
fireRemoved(IRBTNode<E> toRemove) |
E |
first() |
TreeSupportNode<E> |
firstNode() |
IInstanceFactory |
getInstanceFactory() |
int |
getModificationCount() |
RedBlackTree<E> |
getTree() |
int |
index(E element)
obtains the position of an element in sorted list view of this tree of
sorted element
|
int |
indexOfNode(IRBTNode<E> node) |
boolean |
isConcurrentAccess() |
boolean |
isEmpty() |
boolean |
isManageNodeIndex() |
boolean |
isNodeAttachedToTree(IRBTNode<E> node)
to know if a node is attached to the tree
|
ListIterator<E> |
iterator() |
ListIterator<E> |
iterator(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
sublist of this list iterator
|
ListIterator<E> |
iterator(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive,
int index)
sublist of this list iterator starting at index
|
ListIterator<E> |
iterator(int index) |
E |
last() |
TreeSupportNode<E> |
lastNode() |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
static TreeSupport |
newInstance(IInstanceFactory instanceFactory,
boolean manageNodeIndex,
boolean concurrentAccess) |
static TreeSupport |
newInstance(IInstanceFactory instanceFactory,
Comparator comparator,
boolean manageNodeIndex,
boolean concurrentAccess) |
static TreeSupport |
newInstance(IInstanceFactory instanceFactory,
Comparator comparator,
boolean manageNodeIndex,
boolean uniqueValue,
boolean concurrentAccess) |
protected TreeSupportNode<E> |
newTreeSupportNode(E element) |
TreeSupportNode<E> |
nextNode(TreeSupportNode<E> node) |
TreeSupportNode<E> |
nodeAtIndex(int index) |
E |
pollFirst() |
E |
pollLast() |
TreeSupportNode<E> |
previousNode(TreeSupportNode<E> node) |
E |
remove(E element) |
E |
remove(IRBTNode<E> toRemove)
remove existing node
|
E |
removeAt(int index) |
E |
removeFirst() |
E |
removeLast() |
void |
removeListener() |
E |
search(Object element) |
void |
setListener(ISupportListener<E> listener) |
int |
size() |
E |
strictlyGreater(E element) |
IRBTNode<E> |
strictlyGreaterNode(E element) |
E |
strictlyLess(E element) |
IRBTNode<E> |
strictlyLessNode(E element) |
protected final RedBlackTree<E> tree
protected final boolean concurrentAccess
protected int modificationCount
protected final transient IInstanceFactory instanceFactory
public TreeSupport(Comparator<? super E> comparator, boolean manageNodeIndex, boolean concurrentAccess)
protected TreeSupport(IInstanceFactory instanceFactory, Comparator<? super E> comparator, boolean manageNodeIndex, boolean concurrentAccess)
protected TreeSupport(Comparator<? super E> comparator, boolean manageNodeIndex, boolean uniqueValue, boolean concurrentAccess)
protected TreeSupport(IInstanceFactory instanceFactory, Comparator<? super E> comparator, boolean manageNodeIndex, boolean uniqueValue, boolean concurrentAccess)
public TreeSupport(boolean manageNodeIndex, boolean concurrentAccess)
protected TreeSupport(IInstanceFactory instanceFactory, boolean manageNodeIndex, boolean concurrentAccess)
public static TreeSupport newInstance(IInstanceFactory instanceFactory, Comparator comparator, boolean manageNodeIndex, boolean concurrentAccess)
public static TreeSupport newInstance(IInstanceFactory instanceFactory, Comparator comparator, boolean manageNodeIndex, boolean uniqueValue, boolean concurrentAccess)
public static TreeSupport newInstance(IInstanceFactory instanceFactory, boolean manageNodeIndex, boolean concurrentAccess)
public IInstanceFactory getInstanceFactory()
public boolean isManageNodeIndex()
public boolean isConcurrentAccess()
public int getModificationCount()
public void setListener(ISupportListener<E> listener)
setListener
in interface ISupportListenable<E>
public void removeListener()
removeListener
in interface ISupportListenable<E>
protected void fireAdded(IRBTNode<E> toAdd) throws RBTException
RBTException
protected void fireRemoved(IRBTNode<E> toRemove) throws RBTException
RBTException
public int size()
public boolean isEmpty()
public E removeAt(int index)
public E removeFirst()
public E removeLast()
public E remove(IRBTNode<E> toRemove)
toRemove
- exixting node to removepublic void add(E element)
protected void appended(TreeSupportNode<E> nodeAppended)
protected void addAll(TreeSupport<E> list)
list
- public void clear()
public Comparator<? super E> comparator()
public IRBTNode<E> strictlyLessNode(E element) throws RBTException
RBTException
public IRBTNode<E> closestLessOrEqualNode(E element) throws RBTException
RBTException
public IRBTNode<E> strictlyGreaterNode(E element) throws RBTException
RBTException
public IRBTNode<E> closestGreaterOrEqualNode(E element) throws RBTException
RBTException
public E pollFirst()
public E pollLast()
public E first()
public TreeSupportNode<E> firstNode()
public E last()
public TreeSupportNode<E> lastNode()
protected TreeSupportNode<E> newTreeSupportNode(E element)
element
- public int index(E element)
element
- the element searching its indexpublic E elementAtIndex(int index)
public TreeSupportNode<E> nodeAtIndex(int index)
public TreeSupportNode<E> nextNode(TreeSupportNode<E> node)
public TreeSupportNode<E> previousNode(TreeSupportNode<E> node)
public ListIterator<E> iterator()
public ListIterator<E> iterator(int index)
public ListIterator<E> listIterator()
public ListIterator<E> listIterator(int index)
public ListIterator<E> iterator(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
fromElement
- starting element for iterationfromInclusive
- true if starting element is included in iterationtoElement
- ending element for iterationtoInclusive
- true if ending element is included in iterationpublic ListIterator<E> iterator(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive, int index)
fromElement
- starting element for iterationfromInclusive
- true if starting element is included in iterationtoElement
- ending element for iterationtoInclusive
- true if ending element is included in iterationindex
- start indexpublic ListIterator<E> descendingIterator()
public ListIterator<E> descendingIterator(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
fromElement
- ending element for iterationfromInclusive
- true if ending element is included in iterationtoElement
- starting element for iterationtoInclusive
- true if starting element is included in iterationpublic TreeSupport<E> clone()
public boolean isNodeAttachedToTree(IRBTNode<E> node)
node
- node to check if attached to the tree@Fortest public RedBlackTree<E> getTree()
Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.