protected boolean addChild(BaseNode node) { boolean add = false; char c = node.getChar(); BaseNode target = getChild(c); if (target == null) { child[c] = node; add = true; } else { switch (node.status) { case UNDEFINED_0: if (target.status != Status.NOT_WORD_1) { target.status = Status.NOT_WORD_1; add = true; } break; case NOT_WORD_1: if (target.status == Status.WORD_END_3) { target.status = Status.WORD_MIDDLE_2; } break; case WORD_END_3: if (target.status == Status.NOT_WORD_1) { target.status = Status.WORD_MIDDLE_2; } if (target.getValue() == null) { add = true; } target.setValue(node.getValue()); break; } } return(add); }
public int compareTo(BaseNode <V> other) { return(compareTo(other.getChar())); }