/** * Checks if this is the to word. * * @param token the token * @return true, if is to */ public boolean isTo(WordToken token) { return token.equals(to); }
/** * Checks if this is the to word. * * @param token the token * @return true, if is to */ public boolean isTo(WordToken token) { return token.equals(to); }
/** * Gets the other word (other side) * * @param token the token * @return the other */ public WordToken getOther(WordToken token) { return token.equals(to) ? from : to; }
/** * Checks if this is the from word? * * @param token the token * @return true, if is from */ public boolean isFrom(WordToken token) { return token.equals(from); }
/** * Checks if this is the from word? * * @param token the token * @return true, if is from */ public boolean isFrom(WordToken token) { return token.equals(from); }
/** * Gets the other word (other side) * * @param token the token * @return the other */ public WordToken getOther(WordToken token) { return token.equals(to) ? from : to; }
return false; } else if (!word.equals(other.word)) { return false;
return false; } else if (!word.equals(other.word)) { return false;
/** * Get the head node from the given set of WordTokens. * * <p>This is the highest word token in the dependency graph covered by the annotation, assumes * they are connected. * * @param annotation * @return the head node */ public Optional<WordToken> getHeadNode(List<WordToken> covered) { if (covered.isEmpty()) { return Optional.empty(); } if (covered.size() == 1) { return Optional.of(covered.get(0)); } WordToken head = covered.get(0); Dependency d = dependents.get(head); while (d != null && !head.equals(d.getGovernor()) && covered.contains(d.getGovernor())) { head = d.getGovernor(); } return Optional.of(head); }
/** * Get the head node from the given set of WordTokens. * * <p>This is the highest word token in the dependency graph covered by the annotation, assumes * they are connected. * * @param annotation * @return the head node */ public Optional<WordToken> getHeadNode(List<WordToken> covered) { if (covered.isEmpty()) { return Optional.empty(); } if (covered.size() == 1) { return Optional.of(covered.get(0)); } WordToken head = covered.get(0); Dependency d = dependents.get(head); while (d != null && !head.equals(d.getGovernor()) && covered.contains(d.getGovernor())) { head = d.getGovernor(); } return Optional.of(head); }
if (!nodeToToken.get(root).equals(candidate)) { return failure;
if (!nodeToToken.get(root).equals(candidate)) { return failure;