Module inet.ipaddr
Package inet.ipaddr.format.util
Interface BinaryTreeNode.CachingIterator<N extends BinaryTreeNode<E>,E,C>
- All Superinterfaces:
Iterator<N>
- Enclosing class:
BinaryTreeNode<E>
public static interface BinaryTreeNode.CachingIterator<N extends BinaryTreeNode<E>,E,C>
extends Iterator<N>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.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.Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
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
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
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:
-