public boolean containsXHead(DEPNode xHead) { for (DEPArc arc : x_heads) { if (arc.isNode(xHead)) return true; } return false; }
public DEPArc getXHead(DEPNode head) { for (DEPArc arc : x_heads) { if (arc.isNode(head)) return arc; } return null; }
/** * Returns {@code true} if this node is a dependent of the specific node. * @param node the potential head. * @return {@code true} if this node is a dependent of the specific node. */ public boolean isDependentOf(DEPNode node) { return d_head.isNode(node); }
/** * If both the specific node and label match, returns 1. * If only the specific node matches, returns 2. * Otherwise, returns 0. * @param node the node to be compared. * @param label the label to be compared. * @return If both the specific node and label match, returns 1. * If only the specific node matches, returns 2. * Otherwise, returns 0. */ public int compareTo(DEPNode node, String label) { if (isNode(node)) return isLabel(label) ? 1 : 2; return 0; }
private boolean isXDescendentOfAux(DEPNode curr, DEPNode node) { for (DEPArc arc : curr.x_heads) { if (arc.isNode(node) || isXDescendentOfAux(arc.getNode(), node)) return true; } return false; }