Class DefaultByteArrayNodeFactory

  • All Implemented Interfaces:
    NodeFactory, java.io.Serializable

    public class DefaultByteArrayNodeFactory
    extends java.lang.Object
    implements NodeFactory
    A NodeFactory which creates Node objects which store incoming edge characters as a byte array inside the node. This is similar to DefaultCharArrayNodeFactory, except nodes use a single byte to represent each character in UTF-8, instead of Java's default 2-byte UFT-16 encoding.

    This can reduce the memory overhead of storing character data by 50%, but 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Node createNode​(java.lang.CharSequence edgeCharacters, java.lang.Object value, java.util.List<Node> childNodes, boolean isRoot)
      Returns a new Node object which encapsulates the arguments supplied, optionally returning implementations of the Node interface which are memory-optimized for storing only the supplied combination of variables, potentially further optimized based on variable values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultByteArrayNodeFactory

        public DefaultByteArrayNodeFactory()
    • 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: NodeFactory
        Returns a new Node object which encapsulates the arguments supplied, optionally returning implementations of the Node interface which are memory-optimized for storing only the supplied combination of variables, potentially further optimized based on variable values.
        Specified by:
        createNode in interface NodeFactory
        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 characters
        value - 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 node
        isRoot - 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