protected Token create() throws MaltChainedException { return new Token(); } public void resetObject(Token o) throws MaltChainedException { o.clear(); }
public void resetObject(Token o) throws MaltChainedException { o.clear(); } };
public DependencyNode findComponent() { return findComponent(this); }
public void addHeadEdgeLabel(SymbolTable table, String symbol) throws MaltChainedException { if (hasHead()) { getHeadEdge().addLabel(table, symbol); } }
/** * Returns the right sibling at the same side of head as the node it self. If not found <code>null</code> is returned * * @return the right sibling at the same side of head as the node it self. If not found <code>null</code> is returned */ public DependencyNode getSameSideRightSibling() throws MaltChainedException { if (getHead() == null) { return null; } else if (this.getIndex() < getHead().getIndex()) { final SortedSet<DependencyNode> tailSet = getHead().getLeftDependents().tailSet(this); if (tailSet.size() <= 1) { return null; } return tailSet.toArray(new DependencyNode[tailSet.size()])[1]; } else if (this.getIndex() > getHead().getIndex()) { final SortedSet<DependencyNode> tailSet = getHead().getRightDependents().tailSet(this); if (tailSet.size() <= 1) { return null; } return tailSet.toArray(new DependencyNode[tailSet.size()])[1]; } return null; }
public Set<SymbolTable> getHeadEdgeLabelTypes() throws MaltChainedException { return getHeadEdge().getLabelTypes(); }
public void removeOutgoingEdge(Edge out) throws MaltChainedException { super.removeOutgoingEdge(out); if (out.getType() == Edge.DEPENDENCY_EDGE && out.getTarget() instanceof DependencyNode) { final DependencyNode dependent = (DependencyNode)out.getTarget(); if (compareTo(dependent) > 0) { leftDependents.remove((DependencyNode)dependent); } else if (compareTo(dependent) < 0) { rightDependents.remove((DependencyNode)dependent); } } }
protected void getDependencyDominationSet(SortedSet<DependencyNode> dominationSet) { if (leftDependents.size() > 0 || rightDependents.size() > 0) { dominationSet.addAll(leftDependents); dominationSet.addAll(rightDependents); for (DependencyNode node : leftDependents) { ((Token)node).getDependencyDominationSet(dominationSet); } for (DependencyNode node : rightDependents) { ((Token)node).getDependencyDominationSet(dominationSet); } } }
/** * Returns the left sibling if it exists, otherwise <code>null</code> * * @return the left sibling if it exists, otherwise <code>null</code> */ public DependencyNode getLeftSibling() throws MaltChainedException { if (getHead() == null) { return null; } DependencyNode candidate = null; for (DependencyNode node : getHead().getLeftDependents()) { if (node == this) { return candidate; } candidate = node; } for (DependencyNode node : getHead().getRightDependents()) { if (node == this) { return candidate; } candidate = node; } return null; }
candidate = ldep; tmp = ((Token)ldep).getLeftmostProperDescendant(); if (tmp == null) { continue; candidate = rdep; tmp = ((Token)rdep).getLeftmostProperDescendant(); if (tmp == null) { continue;
candidate = ldep; tmp = ((Token)ldep).getLeftmostDescendant(); if (tmp == null) { continue; candidate = rdep; tmp = ((Token)rdep).getLeftmostDescendant(); if (tmp == null) { continue;
public void addHeadEdgeLabel(SymbolTable table, int code) throws MaltChainedException { if (hasHead()) { getHeadEdge().addLabel(table, code); } }
/** * Returns the left sibling at the same side of head as the node it self. If not found <code>null</code> is returned * * @return the left sibling at the same side of head as the node it self. If not found <code>null</code> is returned */ public DependencyNode getSameSideLeftSibling() throws MaltChainedException { if (getHead() == null) { return null; } else if (this.getIndex() < getHead().getIndex()) { try { return getHead().getLeftDependents().headSet(this).last(); } catch (NoSuchElementException e) { return null; } } else if (this.getIndex() > getHead().getIndex()) { try { return getHead().getRightDependents().headSet(this).last(); } catch (NoSuchElementException e) { return null; } } return null; }
public LabelSet getHeadEdgeLabelSet() throws MaltChainedException { return getHeadEdge().getLabelSet(); }
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); } } }
protected void getDependencyDominationSet(SortedSet<DependencyNode> dominationSet) { if (leftDependents.size() > 0 || rightDependents.size() > 0) { dominationSet.addAll(leftDependents); dominationSet.addAll(rightDependents); for (DependencyNode node : leftDependents) { ((Token)node).getDependencyDominationSet(dominationSet); } for (DependencyNode node : rightDependents) { ((Token)node).getDependencyDominationSet(dominationSet); } } }
public boolean hasHeadEdgeLabel(SymbolTable table) throws MaltChainedException { if (!hasHead()) { return false; } return getHeadEdge().hasLabel(table); }
/** * Returns the right sibling if it exists, otherwise <code>null</code> * * @return the right sibling if it exists, otherwise <code>null</code> */ public DependencyNode getRightSibling() throws MaltChainedException { if (getHead() == null) { return null; } for (DependencyNode node : getHead().getLeftDependents()) { if (node.getIndex() > this.getIndex()) { return node; } } for (DependencyNode node : getHead().getRightDependents()) { if (node.getIndex() > this.getIndex()) { return node; } } return null; }
public String getHeadEdgeLabelSymbol(SymbolTable table) throws MaltChainedException { return getHeadEdge().getLabelSymbol(table); }