Interface NodeFactory
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
DefaultByteArrayNodeFactory
,DefaultCharArrayNodeFactory
,DefaultCharSequenceNodeFactory
,SmartArrayBasedNodeFactory
public interface NodeFactory extends java.io.Serializable
An interface for a factory which creates newNode
objects on demand, to encapsulate specified variables. Factory objects can choose to return implementations of theNode
interface which are memory-optimized for storing only the given variables, potentially further optimized based on variable values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Node
createNode(java.lang.CharSequence edgeCharacters, java.lang.Object value, java.util.List<Node> childNodes, boolean isRoot)
-
-
-
Method Detail
-
createNode
Node createNode(java.lang.CharSequence edgeCharacters, java.lang.Object value, java.util.List<Node> childNodes, boolean isRoot)
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.- 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
-
-