Module inet.ipaddr
Package inet.ipaddr.format.util
Interface BinaryTreeNode.CachingIterator<N extends BinaryTreeNode<E>,E,C>
-
- All Superinterfaces:
java.util.Iterator<N>
- Enclosing class:
- BinaryTreeNode<E>
public static interface BinaryTreeNode.CachingIterator<N extends BinaryTreeNode<E>,E,C> extends java.util.Iterator<N>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
cacheWithLowerSubNode(C object)
AfterIterator.next()
has returned a node, calling this method caches the provided object with the lower sub-node so that it can be retrieved withgetCached()
when the lower sub-node is visited later.boolean
cacheWithUpperSubNode(C object)
AfterIterator.next()
has returned a node, calling this method caches the provided object with the upper sub-node so that it can be retrieved withgetCached()
when the upper sub-node is visited later.C
getCached()
AfterIterator.next()
has returned a node, if an object was cached by a call tocacheWithLowerSubNode(Object)
orcacheWithUpperSubNode(Object)
was called when that node's parent was previously returned byIterator.next()
, then this returns that cached object.
-
-
-
Method Detail
-
getCached
C getCached()
AfterIterator.next()
has returned a node, if an object was cached by a call tocacheWithLowerSubNode(Object)
orcacheWithUpperSubNode(Object)
was called when that node's parent was previously returned byIterator.next()
, then this returns that cached object.- Returns:
- the cached object
-
cacheWithLowerSubNode
boolean cacheWithLowerSubNode(C object)
AfterIterator.next()
has returned a node, calling this method caches the provided object with the lower sub-node so that it can be retrieved withgetCached()
when the lower sub-node is visited later.Returns false if it could not be cached, either because the node has since been removed with a call to
Iterator.remove()
, becauseIterator.next()
has not been called yet, or because there is no lower sub node for the node previously returned byIterator.next()
.The caching and retrieval is done in constant time.
- Parameters:
object
- the object to be retrieved later.
-
cacheWithUpperSubNode
boolean cacheWithUpperSubNode(C object)
AfterIterator.next()
has returned a node, calling this method caches the provided object with the upper sub-node so that it can be retrieved withgetCached()
when the upper sub-node is visited later.Returns false if it could not be cached, either because the node has since been removed with a call to
Iterator.remove()
, becauseIterator.next()
has not been called yet, or because there is no upper sub node for the node previously returned byIterator.next()
.The caching and retrieval is done in constant time.
- Parameters:
object
- the object to be retrieved later.- Returns:
-
-