it.unimi.dsi.mg4j.util
Class ImmutableBinaryTrie.Node

java.lang.Object
  extended by it.unimi.dsi.mg4j.util.ImmutableBinaryTrie.Node
All Implemented Interfaces:
Serializable
Enclosing class:
ImmutableBinaryTrie

protected static class ImmutableBinaryTrie.Node
extends Object
implements Serializable

A node in the trie.

See Also:
Serialized Form

Field Summary
 ImmutableBinaryTrie.Node left
           
 long[] path
          An array containing the path compacted in this node (null if there is no compaction at this node).
 int pathLength
          The length of the path compacted in this node (0 if there is no compaction at this node).
 ImmutableBinaryTrie.Node right
           
 int word
          If nonnegative, this node represent the word-th word.
 
Constructor Summary
ImmutableBinaryTrie.Node(BitVector path)
          Creates a node that does not represent a word.
ImmutableBinaryTrie.Node(BitVector path, int word)
          Creates a node representing a word.
 
Method Summary
 boolean isLeaf()
          Returns true if this node is a leaf.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

left

public ImmutableBinaryTrie.Node left

right

public ImmutableBinaryTrie.Node right

path

public final long[] path
An array containing the path compacted in this node (null if there is no compaction at this node).


pathLength

public final int pathLength
The length of the path compacted in this node (0 if there is no compaction at this node).


word

public final int word
If nonnegative, this node represent the word-th word.

Constructor Detail

ImmutableBinaryTrie.Node

public ImmutableBinaryTrie.Node(BitVector path,
                                int word)
Creates a node representing a word.

Note that the long array contained in path will be stored inside the node.

Parameters:
path - the path compacted in this node, or null for the empty path.
word - the index of the word represented by this node.

ImmutableBinaryTrie.Node

public ImmutableBinaryTrie.Node(BitVector path)
Creates a node that does not represent a word.

Parameters:
path - the path compacted in this node, or null for the empty path.
Method Detail

isLeaf

public boolean isLeaf()
Returns true if this node is a leaf.

Returns:
true if this node is a leaf.

toString

public String toString()
Overrides:
toString in class Object