org.apache.asn1.ber
Interface TupleNode

All Known Subinterfaces:
MutableTupleNode
All Known Implementing Classes:
DefaultMutableTupleNode

public interface TupleNode

A TLV Tuple tree node modeled in the likeness of a TreeNode.

Version:
$Rev: 157644 $
Author:
Apache Directory Project

Method Summary
 void accept(TupleNodeVisitor visitor)
          Element/node accept method for visitor pattern.
 void encode(java.nio.ByteBuffer buf)
          Recursively encodes the tree rooted at this node.
 boolean equals(java.lang.Object obj)
          Checks to see if two trees are equal.
 int getChildCount()
          Gets the number of child nodes contained.
 java.util.Iterator getChildren()
          Gets an iterator over this node's children.
 TupleNode getChildTupleNodeAt(int index)
          Gets a tuple node at an index.
 int getIndex(TupleNode node)
          Gets the index of a child if the child node if it exists.
 TupleNode getParentTupleNode()
          Gets the parent tuple node to this node or null if a parent does not exist.
 Tuple getTuple()
          Gets the Tuple this node represents.
 java.util.List getValueChunks()
          Gets the chunked value buffer fragments collected within this node.
 int size()
          Gets the number of child nodes contained.
 

Method Detail

getParentTupleNode

public TupleNode getParentTupleNode()
Gets the parent tuple node to this node or null if a parent does not exist. The analogous method on the TreeNode interface would be getParent().

Returns:
the parent node or null if one does not exist

getChildren

public java.util.Iterator getChildren()
Gets an iterator over this node's children. The analogous interface on the TreeNode interface would be children which returns an Enumeration instead of an Iterator.

Returns:
an iterator over this node's children

getChildTupleNodeAt

public TupleNode getChildTupleNodeAt(int index)
Gets a tuple node at an index. The analogous interface on TreeNode would be the getChildAt method.

Parameters:
index - the index of the child to get
Returns:
the child node at the specified index

getValueChunks

public java.util.List getValueChunks()
Gets the chunked value buffer fragments collected within this node.

Returns:
the value buffer parts for this node

getIndex

public int getIndex(TupleNode node)
Gets the index of a child if the child node if it exists. The analog within TreeNode takes a TreeNode instead of a TupleNode.

Parameters:
node - the child node to get the index for
Returns:
the index of the child node or -1 if the node does not exist

getChildCount

public int getChildCount()
Gets the number of child nodes contained. This is the same as in TreeNode.getChildCount() as well.

Returns:
the number of child nodes contained.

size

public int size()
Gets the number of child nodes contained. This is the same as in TreeNode.size() as well.

Returns:
the number of children

getTuple

public Tuple getTuple()
Gets the Tuple this node represents. This is the analogous to TreeNode.getUserObject().

Returns:
the tuple this node represents or null if one has not been assigned

encode

public void encode(java.nio.ByteBuffer buf)
Recursively encodes the tree rooted at this node.

Parameters:
buf - the buffer populated with the BER encoded tlv tree contents

equals

public boolean equals(java.lang.Object obj)
Checks to see if two trees are equal. Note that the order of children within the tree as well as the tuples and their contents make a difference to equals().

Parameters:
obj - the object to compare this node to
Returns:
true if the obj and this node are exact replicas of one another

accept

public void accept(TupleNodeVisitor visitor)
Element/node accept method for visitor pattern.

Parameters:
visitor - the tuple node tree structure visitor
See Also:
TupleNodeVisitor


Copyright © 2004-2006 . All Rights Reserved.