Class ByteArrayNodeNonLeafNullValue
- java.lang.Object
-
- com.googlecode.concurrenttrees.radix.node.concrete.bytearray.ByteArrayNodeNonLeafNullValue
-
- All Implemented Interfaces:
Node,NodeCharacterProvider,java.io.Serializable
public class ByteArrayNodeNonLeafNullValue extends java.lang.Object implements Node
Similar toCharArrayNodeNonLeafNullValuebut 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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]incomingEdgeCharArrayprivate java.util.concurrent.atomic.AtomicReferenceArray<Node>outgoingEdgesprivate java.util.List<Node>outgoingEdgesAsList
-
Constructor Summary
Constructors Constructor Description ByteArrayNodeNonLeafNullValue(java.lang.CharSequence edgeCharSequence, java.util.List<Node> outgoingEdges)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.CharSequencegetIncomingEdge()Returns all characters of the "edge" encoded in this node, belonging to the connection from a parent node to this node.java.lang.CharactergetIncomingEdgeFirstCharacter()Returns the first character of the "edge" encoded in this node, belonging to the connection from a parent node to this node.NodegetOutgoingEdge(java.lang.Character edgeFirstCharacter)Returns the child of this node whose edge starts with the given first character.java.util.List<Node>getOutgoingEdges()Returns a read-only list of the child nodes to which this node has outgoing edges, i.e.java.lang.ObjectgetValue()Returns a value object which has been associated with a key and which is stored in this node, or returnsnullif no value is stored in this node.java.lang.StringtoString()voidupdateOutgoingEdge(Node childNode)Updates the child node reference for a given edge (identified by its first character) to point to a different child node.
-
-
-
Constructor Detail
-
ByteArrayNodeNonLeafNullValue
public ByteArrayNodeNonLeafNullValue(java.lang.CharSequence edgeCharSequence, java.util.List<Node> outgoingEdges)
-
-
Method Detail
-
getIncomingEdge
public java.lang.CharSequence getIncomingEdge()
Description copied from interface:NodeReturns all characters of the "edge" encoded in this node, belonging to the connection from a parent node to this node.- Specified by:
getIncomingEdgein interfaceNode- Returns:
- All characters of the "edge" encoded in this node
-
getIncomingEdgeFirstCharacter
public java.lang.Character getIncomingEdgeFirstCharacter()
Description copied from interface:NodeReturns the first character of the "edge" encoded in this node, belonging to the connection from a parent node to this node.- Specified by:
getIncomingEdgeFirstCharacterin interfaceNode- Specified by:
getIncomingEdgeFirstCharacterin interfaceNodeCharacterProvider- Returns:
- The first character of the "edge" encoded in this node
-
getValue
public java.lang.Object getValue()
Description copied from interface:NodeReturns a value object which has been associated with a key and which is stored in this node, or returnsnullif no value is stored in this node.
-
getOutgoingEdge
public Node getOutgoingEdge(java.lang.Character edgeFirstCharacter)
Description copied from interface:NodeReturns the child of this node whose edge starts with the given first character. This read must be performed atomically, in relation to writes made viaNode.updateOutgoingEdge(Node).- Specified by:
getOutgoingEdgein interfaceNode- 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
nullif this node has no such outgoing edge
-
updateOutgoingEdge
public void updateOutgoingEdge(Node childNode)
Description copied from interface:NodeUpdates 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 viaNode.getOutgoingEdge(Character).- Specified by:
updateOutgoingEdgein interfaceNode- Parameters:
childNode- The new child node to associated with this edge
-
getOutgoingEdges
public java.util.List<Node> getOutgoingEdges()
Description copied from interface:NodeReturns 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:
getOutgoingEdgesin interfaceNode- Returns:
- A read-only list of the child nodes to which this node has outgoing edges
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-