public void clear() throws MaltChainedException { super.clear(); children.clear(); parent = null; index = -1; }
public boolean equals(Object obj) { Token v = (Token)obj; if (!(this.predecessor == v.predecessor && this.successor == v.successor)) return false; return super.equals(obj); }
public int getLeftmostDescendantIndex() throws MaltChainedException { ComparableNode node = getLeftmostProperDescendant(); return (node != null)?node.getIndex():this.getIndex(); }
public int getRightmostDescendantIndex() throws MaltChainedException { ComparableNode node = getRightmostProperDescendant(); return (node != null)?node.getIndex():this.getIndex(); }
public int hashCode() { return 31 * 7 + super.hashCode(); }
public void addOutgoingEdge(Edge out) throws MaltChainedException { super.addOutgoingEdge(out); if (out.getType() == Edge.DEPENDENCY_EDGE && out.getTarget() instanceof DependencyNode) { final DependencyNode dependent = (DependencyNode)out.getTarget(); if (compareTo(dependent) > 0) { leftDependents.add((DependencyNode)dependent); } else if (compareTo(dependent) < 0) { rightDependents.add((DependencyNode)dependent); } } }
public void removeIncomingEdge(Edge in) throws MaltChainedException { super.removeIncomingEdge(in); if (in.getType() == Edge.PHRASE_STRUCTURE_EDGE && in.getSource() instanceof PhraseStructureNode) { if (in.getSource() == parent) { this.parent = null; } } }
public void addIncomingEdge(Edge in) throws MaltChainedException { super.addIncomingEdge(in); if (in.getType() == Edge.PHRASE_STRUCTURE_EDGE && in.getSource() instanceof PhraseStructureNode) { parent = (PhraseStructureNode)in.getSource(); } }
public int getLeftmostProperDescendantIndex() throws MaltChainedException { ComparableNode node = getLeftmostProperDescendant(); return (node != null)?node.getIndex():-1; }
public int getRightmostProperDescendantIndex() throws MaltChainedException { ComparableNode node = getRightmostProperDescendant(); return (node != null)?node.getIndex():-1; }
public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(getIndex()); sb.append(" [I:"); for (Edge e : incomingEdges) { sb.append(e.getSource().getIndex()); sb.append("("); sb.append(e.toString()); sb.append(")"); if (incomingEdges.last() != e) { sb.append(","); } } sb.append("][O:"); for (Edge e : outgoingEdges) { sb.append(e.getTarget().getIndex()); if (outgoingEdges.last() != e) { sb.append(","); } } sb.append("]"); sb.append(super.toString()); return sb.toString(); } }
public int hashCode() { return 31 * 7 + super.hashCode(); }
public void addOutgoingEdge(Edge out) throws MaltChainedException { super.addOutgoingEdge(out); if (out.getType() == Edge.PHRASE_STRUCTURE_EDGE && out.getTarget() instanceof PhraseStructureNode) { children.add((PhraseStructureNode)out.getTarget()); // boolean notSorted = true; // PhraseStructureNode prev = children.first(); // for (PhraseStructureNode node : children) { // if (prev != node) { // if (node.compareTo(prev) == -1) { // notSorted = false; // System.out.println("NS"); // break; // } // } // prev = node; // } // if (notSorted == false) { // SortedSet<PhraseStructureNode> tmp = new TreeSet<PhraseStructureNode>(children); // children.clear(); // for (PhraseStructureNode node : tmp) { // children.add(node); // } // } } }
return super.compareTo(o);
public void removeIncomingEdge(Edge in) throws MaltChainedException { super.removeIncomingEdge(in); if (in.getSource() != null) { if (in.getType() == Edge.DEPENDENCY_EDGE && in.getSource() instanceof DependencyNode) { heads.remove((DependencyNode)in.getSource()); } else if (in.getType() == Edge.PHRASE_STRUCTURE_EDGE && in.getSource() instanceof PhraseStructureNode) { if (in.getSource() == parent) { this.parent = null; } } } }
public void addIncomingEdge(Edge in) throws MaltChainedException { super.addIncomingEdge(in); if (in.getSource() != null) { if (in.getType() == Edge.DEPENDENCY_EDGE && in.getSource() instanceof DependencyNode) { heads.add((DependencyNode)in.getSource()); } else if (in.getType() == Edge.PHRASE_STRUCTURE_EDGE && in.getSource() instanceof PhraseStructureNode) { parent = (PhraseStructureNode)in.getSource(); } } }
public void clear() throws MaltChainedException { super.clear(); component = this; rank = 0; leftDependents.clear(); rightDependents.clear(); children.clear(); }
public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof NonTerminal)) return false; return super.equals(obj); }
public int hashCode() { int hash = 7; hash = 31 * hash + (null == predecessor ? 0 : predecessor.hashCode()); hash = 31 * hash + (null == successor ? 0 : successor.hashCode()); return 31 * hash + super.hashCode(); }