public class LeftTupleSinkNodeList extends Object implements Externalizable
so that it references
the node before and after it. This way a node can be removed without having to scan the list to find it. This class
does not provide an Iterator implementation as its designed for efficiency and not genericity. There are a number of
ways to iterate the list.
Simple iterator:
for ( LinkedListNode node = list.getFirst(); node != null; node = node.remove() ) {
}
Iterator that pops the first entry:
for ( LinkedListNode node = list.removeFirst(); node != null; node = list.removeFirst() ) {
}
Constructor and Description |
---|
LeftTupleSinkNodeList()
Construct an empty
LinkedList |
Modifier and Type | Method and Description |
---|---|
void |
add(LeftTupleSinkNode node)
Add a
TupleSinkNode to the list. |
void |
clear()
Iterates the list removing all the nodes until there are no more nodes to remove.
|
LeftTupleSinkNode |
getFirst()
Return the first node in the list
|
LeftTupleSinkNode |
getLast()
Return the last node in the list
|
boolean |
isEmpty() |
Iterator |
iterator()
Returns a list iterator
|
void |
readExternal(ObjectInput in) |
void |
remove(LeftTupleSinkNode node)
Removes a
TupleSinkNode from the list. |
LeftTupleSinkNode |
removeFirst()
Remove the first node from the list.
|
LeftTupleSinkNode |
removeLast()
Remove the last node from the list.
|
int |
size() |
void |
writeExternal(ObjectOutput out) |
public LeftTupleSinkNodeList()
LinkedList
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void add(LeftTupleSinkNode node)
TupleSinkNode
to the list. If the LinkedList
is empty then the first and
last nodes are set to the added node.node
- The TupleSinkNode
to be addedpublic void remove(LeftTupleSinkNode node)
TupleSinkNode
from the list. This works by attach the previous reference to the child reference.
When the node to be removed is the first node it calls removeFirst()
. When the node to be removed is the last node
it calls removeLast()
.node
- The TupleSinkNode
to be removed.public final LeftTupleSinkNode getFirst()
TupleSinkNode
.public final LeftTupleSinkNode getLast()
TupleSinkNode
.public LeftTupleSinkNode removeFirst()
TupleSinkNode
.public LeftTupleSinkNode removeLast()
TupleSinkNode
.public final boolean isEmpty()
public void clear()
public final int size()
public Iterator iterator()
Copyright © 2001–2017 JBoss by Red Hat. All rights reserved.