Class SmartArrayBasedNodeFactory
java.lang.Object
com.googlecode.concurrenttrees.radix.node.concrete.SmartArrayBasedNodeFactory
- All Implemented Interfaces:
NodeFactory
,Serializable
A
NodeFactory
which internally uses DefaultByteArrayNodeFactory
to create nodes by default (which
can reduce memory overhead), but falls back to DefaultCharArrayNodeFactory
if characters are detected which
cannot be represented as a single byte.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final NodeFactory
(package private) final NodeFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateNode
(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot)
-
Field Details
-
charArrayNodeFactory
-
byteArrayNodeFactory
-
-
Constructor Details
-
SmartArrayBasedNodeFactory
public SmartArrayBasedNodeFactory()
-
-
Method Details
-
createNode
public Node createNode(CharSequence edgeCharacters, Object value, List<Node> childNodes, boolean isRoot) Description copied from interface:NodeFactory
Returns a newNode
object which encapsulates the arguments supplied, optionally returning implementations of theNode
interface which are memory-optimized for storing only the supplied combination of variables, potentially further optimized based on variable values.- Specified by:
createNode
in 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
Node
interface which stores the given variables
-