loci.formats
Class LZWTreeNode

java.lang.Object
  extended byloci.formats.LZWTreeNode

public class LZWTreeNode
extends Object

An LZW-compression helper class for building a symbol table in tree format.


Field Summary
protected  LZWTreeNode[] children
          List of up to 256 children.
protected  int code
          Code corresponding to this node.
 
Constructor Summary
LZWTreeNode(int code)
          Constructs a new LZW symbol tree node.
 
Method Summary
 void addChild(int index, LZWTreeNode node)
          Sets this node's indexth child to match the given node.
 void addTableEntry(ByteVector string, int code)
          Adds the given code for the specified byte sequence.
 int codeFromString(ByteVector string)
          Gets the code for the given byte sequence, or -1 if none.
 LZWTreeNode getChild(byte index)
          Gets this node's indexth child.
 int getCode()
          Gets the code corresponding to this node.
 void initialize()
          Initializes this node as the root of the symbol table.
 LZWTreeNode nodeFromString(ByteVector string)
          Gets the node for the given byte sequence, or null if none.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected LZWTreeNode[] children
List of up to 256 children.


code

protected int code
Code corresponding to this node.

Constructor Detail

LZWTreeNode

public LZWTreeNode(int code)
Constructs a new LZW symbol tree node.

Method Detail

initialize

public void initialize()
Initializes this node as the root of the symbol table.


getCode

public int getCode()
Gets the code corresponding to this node.


getChild

public LZWTreeNode getChild(byte index)
Gets this node's indexth child.


addChild

public void addChild(int index,
                     LZWTreeNode node)
Sets this node's indexth child to match the given node.


codeFromString

public int codeFromString(ByteVector string)
Gets the code for the given byte sequence, or -1 if none.


nodeFromString

public LZWTreeNode nodeFromString(ByteVector string)
Gets the node for the given byte sequence, or null if none.


addTableEntry

public void addTableEntry(ByteVector string,
                          int code)
Adds the given code for the specified byte sequence.