Package com.helger.base.codec.impl
Class LZWCodec.LZWNode
java.lang.Object
com.helger.base.codec.impl.LZWCodec.LZWNode
- Enclosing class:
LZWCodec
A single LZW node
- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable LZWCodec.LZWNodegetChildNode(byte nIndex) Get the child node at the specified byte index.@Nullable LZWCodec.LZWNodegetChildNode(byte @NonNull [] aBuffer) This will traverse the tree until it gets to the sub node.intvoidsetChildNode(byte nIndex, @NonNull LZWCodec.LZWNode aNode) Set a child node at the specified byte index.toString()
-
Constructor Details
-
LZWNode
public LZWNode()Default constructor for the root node (table index is -1). -
LZWNode
public LZWNode(@Nonnegative int nTableIndex) Constructor with a specific table index.- Parameters:
nTableIndex- The table index for this node. Must be between 0 andLZWCodec.AbstractLZWDictionary.MAX_CODE(inclusive).
-
-
Method Details
-
getTableIndex
@Nonnegative public int getTableIndex()- Returns:
- The table index of this node. Must be ≥ 0.
- Throws:
IllegalStateException- if this is the root node (no table index assigned).
-
setChildNode
Set a child node at the specified byte index.- Parameters:
nIndex- The byte index (0-255) at which the child node is set.aNode- The child node to set. May not benull.
-
getChildNode
Get the child node at the specified byte index.- Parameters:
nIndex- The byte index (0-255) of the child node to retrieve.- Returns:
- The child node at the given index, or
nullif no child exists at that index.
-
getChildNode
This will traverse the tree until it gets to the sub node. This will return null if the node does not exist.- Parameters:
aBuffer- The path to the node.- Returns:
- The node that resides at the data path.
-
toString
-