com.hankcs.hanlp.collection.trie.bintrie
类 BaseNode<V>

java.lang.Object
  继承者 com.hankcs.hanlp.collection.trie.bintrie.BaseNode<V>
类型参数:
V - 值
所有已实现的接口:
Comparable<BaseNode>
直接已知子类:
BinTrie, Node

public abstract class BaseNode<V>
extends Object
implements Comparable<BaseNode>

节点,统一Trie树根和其他节点的基类

作者:
He Han

嵌套类摘要
static class BaseNode.Status
           
 class BaseNode.TrieEntry
           
 
字段摘要
protected  char c
          节点代表的字符
protected  BaseNode[] child
          子节点
protected  BaseNode.Status status
          节点状态
protected  V value
          节点代表的值
 
构造方法摘要
BaseNode()
           
 
方法摘要
protected abstract  boolean addChild(BaseNode node)
          添加子节点
 int compareTo(BaseNode other)
           
 int compareTo(char other)
          重载,与字符的比较
protected  char getChar()
           
abstract  BaseNode getChild(char c)
          获取子节点
 BaseNode.Status getStatus()
          获取节点的成词状态
 V getValue()
          获取节点对应的值
protected  boolean hasChild(char c)
          是否含有子节点
 void setValue(V value)
          设置节点对应的值
 String toString()
           
 BaseNode<V> transition(char[] path, int begin)
           
protected  void walk(StringBuilder sb, Set<Map.Entry<String,V>> entrySet)
           
protected  void walkToLoad(ByteArray byteArray, _ValueArray<V> valueArray)
           
protected  void walkToSave(DataOutputStream out)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

child

protected BaseNode[] child
子节点


status

protected BaseNode.Status status
节点状态


c

protected char c
节点代表的字符


value

protected V value
节点代表的值

构造方法详细信息

BaseNode

public BaseNode()
方法详细信息

transition

public BaseNode<V> transition(char[] path,
                              int begin)

addChild

protected abstract boolean addChild(BaseNode node)
添加子节点

返回:
true-新增了节点 false-修改了现有节点

hasChild

protected boolean hasChild(char c)
是否含有子节点

参数:
c - 子节点的char
返回:
是否含有

getChar

protected char getChar()

getChild

public abstract BaseNode getChild(char c)
获取子节点

参数:
c - 子节点的char
返回:
子节点

getValue

public final V getValue()
获取节点对应的值

返回:

setValue

public final void setValue(V value)
设置节点对应的值

参数:
value - 值

compareTo

public int compareTo(BaseNode other)
指定者:
接口 Comparable<BaseNode> 中的 compareTo

compareTo

public int compareTo(char other)
重载,与字符的比较

参数:
other -
返回:

getStatus

public BaseNode.Status getStatus()
获取节点的成词状态

返回:

walk

protected void walk(StringBuilder sb,
                    Set<Map.Entry<String,V>> entrySet)

walkToSave

protected void walkToSave(DataOutputStream out)
                   throws IOException
抛出:
IOException

walkToLoad

protected void walkToLoad(ByteArray byteArray,
                          _ValueArray<V> valueArray)

toString

public String toString()
覆盖:
Object 中的 toString


Copyright © 2014–2015 鐮佸啘鍦�/a>. All rights reserved.