Class SmartArrayBasedNodeFactory
- java.lang.Object
-
- com.googlecode.concurrenttrees.radix.node.concrete.SmartArrayBasedNodeFactory
-
- All Implemented Interfaces:
NodeFactory,java.io.Serializable
public class SmartArrayBasedNodeFactory extends java.lang.Object implements NodeFactory
ANodeFactorywhich internally usesDefaultByteArrayNodeFactoryto create nodes by default (which can reduce memory overhead), but falls back toDefaultCharArrayNodeFactoryif characters are detected which cannot be represented as a single byte.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) NodeFactorybyteArrayNodeFactory(package private) NodeFactorycharArrayNodeFactory
-
Constructor Summary
Constructors Constructor Description SmartArrayBasedNodeFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodecreateNode(java.lang.CharSequence edgeCharacters, java.lang.Object value, java.util.List<Node> childNodes, boolean isRoot)
-
-
-
Field Detail
-
charArrayNodeFactory
final NodeFactory charArrayNodeFactory
-
byteArrayNodeFactory
final NodeFactory byteArrayNodeFactory
-
-
Method Detail
-
createNode
public Node createNode(java.lang.CharSequence edgeCharacters, java.lang.Object value, java.util.List<Node> childNodes, boolean isRoot)
Description copied from interface:NodeFactoryReturns a newNodeobject which encapsulates the arguments supplied, optionally returning implementations of theNodeinterface which are memory-optimized for storing only the supplied combination of variables, potentially further optimized based on variable values.- Specified by:
createNodein interfaceNodeFactory- Parameters:
edgeCharacters- Provides edge characters to be stored in the node. This is never null. In the case of (re-)constructing the root node, this will contain zero characters, otherwise will always contain one or more charactersvalue- An arbitrary object to associate with the node. This can be null, but it will not be null if dealing with a leaf node (when childNodes will be empty)childNodes- A list of child nodes to store in the node. This will never be null, but may be empty when building a leaf nodeisRoot- Indicates if this will be the root node, in which case edge characters will be non-null but empty, value will be null, and child nodes will be non-null but may be empty- Returns:
- An object implementing the
Nodeinterface which stores the given variables
-
-