|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.asn1.ber.DefaultMutableTupleNode
The default mutable tuple node.
Field Summary | |
private java.util.ArrayList |
children
a list of this node's children |
private DefaultMutableTupleNode |
parent
this node's parent node |
private Tuple |
tuple
this node's tuple user object |
private java.util.List |
valueChunks
this node's accumulated ByteBuffer value chunks |
Constructor Summary | |
DefaultMutableTupleNode()
Creates a node without a parent and without a tuple. |
|
DefaultMutableTupleNode(Tuple tuple)
Creates a node without a parent using a tuple. |
|
DefaultMutableTupleNode(Tuple tuple,
java.util.List valueChunks)
Creates a node without a parent. |
Method Summary | |
void |
accept(TupleNodeVisitor visitor)
Recursively descends the tree at this node based on the order of the visitor. |
void |
addFront(DefaultMutableTupleNode child)
Adds a child node to the front of the child list. |
void |
addLast(DefaultMutableTupleNode child)
Adds a child node to the end of the child list. |
void |
addValueChunk(java.nio.ByteBuffer valueChunk)
Adds a buffer containing the entire buffer or a chunked peice of it. |
void |
encode(java.nio.ByteBuffer dest)
Depth first generation of this tlv tuple node's encoded image. |
static boolean |
equals(DefaultMutableTupleNode n1,
DefaultMutableTupleNode n2)
Checks to see if two nodes equal one another. |
boolean |
equals(java.lang.Object obj)
Checks to see if this node and its children equal another exactly. |
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. |
private java.lang.String |
getHex(int val)
Gets the hex encoding of an integer with the most significant bites first. |
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. |
void |
insert(MutableTupleNode child,
int index)
Adds child to the receiver at index. |
void |
printDepthFirst(java.lang.StringBuffer buf,
int level)
Generates a depth first traversal of this node. |
void |
remove(int index)
Removes the child at index from the receiver. |
void |
remove(MutableTupleNode node)
Removes node from the receiver. |
void |
removeFromParent()
Removes the receiver from its parent. |
void |
setParent(MutableTupleNode newParent)
Sets the parent of the receiver to newParent. |
void |
setTuple(Tuple t)
Resets the Tuple of the receiver object. |
void |
setTuple(Tuple t,
java.util.List valueChunks)
Resets the Tuple of the receiver object. |
int |
size()
Gets the number of child nodes contained. |
java.lang.String |
toDepthFirstString()
Generates a depth first traversal of this node. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Tuple tuple
private java.util.ArrayList children
private DefaultMutableTupleNode parent
private java.util.List valueChunks
Constructor Detail |
public DefaultMutableTupleNode()
public DefaultMutableTupleNode(Tuple tuple)
tuple
- the tuple to set for this nodepublic DefaultMutableTupleNode(Tuple tuple, java.util.List valueChunks)
tuple
- the tuple to set for this nodeMethod Detail |
public void insert(MutableTupleNode child, int index)
MutableTupleNode
insert
in interface MutableTupleNode
child
- the child to addindex
- the index at which to insert the childpublic void addFront(DefaultMutableTupleNode child)
child
- the child to add to the frontpublic void addLast(DefaultMutableTupleNode child)
child
- the child to add to the endpublic void remove(int index)
MutableTupleNode
remove
in interface MutableTupleNode
index
- the index at which to remove the childpublic void remove(MutableTupleNode node)
MutableTupleNode
remove
in interface MutableTupleNode
node
- the node to removepublic void removeFromParent()
MutableTupleNode
removeFromParent
in interface MutableTupleNode
public void setParent(MutableTupleNode newParent)
MutableTupleNode
setParent
in interface MutableTupleNode
newParent
- the new parent to setpublic TupleNode getParentTupleNode()
TupleNode
TreeNode
interface
would be getParent()
.
getParentTupleNode
in interface TupleNode
public java.util.Iterator getChildren()
TupleNode
TreeNode
interface would be children
which
returns an Enumeration
instead of an Iterator
.
getChildren
in interface TupleNode
public TupleNode getChildTupleNodeAt(int index)
TupleNode
TreeNode
would be the getChildAt
method.
getChildTupleNodeAt
in interface TupleNode
index
- the index of the child to get
public int getIndex(TupleNode node)
TupleNode
TreeNode takes a TreeNode
instead of a
TupleNode
.
- Specified by:
getIndex
in interface 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
public int getChildCount()
TupleNode
TreeNode.getChildCount()
as well.
getChildCount
in interface TupleNode
public int size()
TupleNode
TreeNode.size()
as well.
size
in interface TupleNode
public Tuple getTuple()
TupleNode
TreeNode.getUserObject()
.
getTuple
in interface TupleNode
public void setTuple(Tuple t)
MutableTupleNode
setTuple
in interface MutableTupleNode
t
- the tuple to set for this nodepublic void setTuple(Tuple t, java.util.List valueChunks)
MutableTupleNode
setTuple
in interface MutableTupleNode
t
- the tuple to set for this nodevalueChunks
- the list of value chunk bufferspublic java.util.List getValueChunks()
TupleNode
getValueChunks
in interface TupleNode
public void addValueChunk(java.nio.ByteBuffer valueChunk)
MutableTupleNode
addValueChunk
in interface MutableTupleNode
valueChunk
- a chunk of the value as a byte bufferpublic void encode(java.nio.ByteBuffer dest)
encode
in interface TupleNode
dest
- the buffer populated with the BER encoded tlv tree contentsTupleNode.encode(ByteBuffer)
public java.lang.String toString()
public java.lang.String toDepthFirstString()
private java.lang.String getHex(int val)
val
- the integer to break up into 4 bytes and hex encode
public void printDepthFirst(java.lang.StringBuffer buf, int level)
buf
- the buffer to capture the traversal intolevel
- the level down into the treepublic boolean equals(java.lang.Object obj)
equals
in interface TupleNode
Object.equals(java.lang.Object)
public static boolean equals(DefaultMutableTupleNode n1, DefaultMutableTupleNode n2)
n1
- the first noden2
- the second node
n1.equals(n2)
exactly otherwise falsepublic void accept(TupleNodeVisitor visitor)
accept
in interface TupleNode
visitor
- the tuple node tree structure visitorTupleNode.accept(TupleNodeVisitor)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |