com.googlecode.concurrenttrees.radix.node.concrete.bytearray
Class ByteArrayNodeLeafNullValue

java.lang.Object
  extended by com.googlecode.concurrenttrees.radix.node.concrete.bytearray.ByteArrayNodeLeafNullValue
All Implemented Interfaces:
Node, NodeCharacterProvider

public class ByteArrayNodeLeafNullValue
extends Object
implements Node

Similar to CharArrayNodeLeafNullValue but represents each character in UTF-8, instead of Java's default 2-byte UFT-16 encoding.

Supports only characters which can be represented as a single byte in UTF-8. Throws an exception if characters are encountered which cannot be represented as a single byte.

Author:
Niall Gallagher

Constructor Summary
ByteArrayNodeLeafNullValue(CharSequence edgeCharSequence)
           
 
Method Summary
 CharSequence getIncomingEdge()
          Returns all characters of the "edge" encoded in this node, belonging to the connection from a parent node to this node.
 Character getIncomingEdgeFirstCharacter()
          Returns the first character of the "edge" encoded in this node, belonging to the connection from a parent node to this node.
 Node getOutgoingEdge(Character edgeFirstCharacter)
          Returns the child of this node whose edge starts with the given first character.
 List<Node> getOutgoingEdges()
          Returns a read-only list of the child nodes to which this node has outgoing edges, i.e.
 Object getValue()
          Returns a value object which has been associated with a key and which is stored in this node, or returns null if no value is stored in this node.
 String toString()
           
 void updateOutgoingEdge(Node childNode)
          Updates the child node reference for a given edge (identified by its first character) to point to a different child node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteArrayNodeLeafNullValue

public ByteArrayNodeLeafNullValue(CharSequence edgeCharSequence)
Method Detail

getIncomingEdge

public CharSequence getIncomingEdge()
Description copied from interface: Node
Returns all characters of the "edge" encoded in this node, belonging to the connection from a parent node to this node.

Specified by:
getIncomingEdge in interface Node
Returns:
All characters of the "edge" encoded in this node

getIncomingEdgeFirstCharacter

public Character getIncomingEdgeFirstCharacter()
Description copied from interface: Node
Returns the first character of the "edge" encoded in this node, belonging to the connection from a parent node to this node.

Specified by:
getIncomingEdgeFirstCharacter in interface Node
Specified by:
getIncomingEdgeFirstCharacter in interface NodeCharacterProvider
Returns:
The first character of the "edge" encoded in this node

getValue

public Object getValue()
Description copied from interface: Node
Returns a value object which has been associated with a key and which is stored in this node, or returns null if no value is stored in this node.

Specified by:
getValue in interface Node
Returns:
A value object which has been associated with a key and which is stored in this node, or returns null if no value is stored in this node

getOutgoingEdge

public Node getOutgoingEdge(Character edgeFirstCharacter)
Description copied from interface: Node
Returns the child of this node whose edge starts with the given first character.

This read must be performed atomically, in relation to writes made via Node.updateOutgoingEdge(Node).

Specified by:
getOutgoingEdge in interface Node
Parameters:
edgeFirstCharacter - The first character of the edge for which the associated child node is required
Returns:
The child of this node whose edge starts with the given first character, or null if this node has no such outgoing edge

updateOutgoingEdge

public void updateOutgoingEdge(Node childNode)
Description copied from interface: Node
Updates the child node reference for a given edge (identified by its first character) to point to a different child node.

The first character of the given child node's edge must match the first character of an existing outgoing edge from this node.

This write must be performed atomically, in relation to reads made via Node.getOutgoingEdge(Character).

Specified by:
updateOutgoingEdge in interface Node
Parameters:
childNode - The new child node to associated with this edge

getOutgoingEdges

public List<Node> getOutgoingEdges()
Description copied from interface: Node
Returns a read-only list of the child nodes to which this node has outgoing edges, i.e. child nodes which have incoming edges from this node.

It is intended that this method will be used for copying/cloning nodes.

Specified by:
getOutgoingEdges in interface Node
Returns:
A read-only list of the child nodes to which this node has outgoing edges

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.