public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabuNodes, Collection<GrammaticalRelation> tabuRelns, Predicate<IndexedWord> tabuTest) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabuNodes, tabuRelns, tabuTest); return descendantSet; }
/** * Finds the descendents of the given node in graph, avoiding the given set of nodes */ public static Set<IndexedWord> tabuDescendants(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabu) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabu, null, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabuNodes, Collection<GrammaticalRelation> tabuRelns, BiPredicate<IndexedWord,SemanticGraph> tabuTest) { if ( ! sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabuNodes, tabuRelns, tabuTest); return descendantSet; }
/** * Finds the set of descendants for a node in the graph, avoiding the set of nodes and the * set of edge relations. NOTE: these edges are encountered from the downward cull, * from governor to dependent. */ public static Set<IndexedWord> tabuDescendants(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabu, Collection<GrammaticalRelation> tabuRelns) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabu, tabuRelns, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuRelns(SemanticGraph sg, IndexedWord vertex, Collection<GrammaticalRelation> tabuRelns) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, Generics.newHashSet(), tabuRelns, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<GrammaticalRelation> tabuRelns, Predicate<IndexedWord> tabuTest) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, Generics.newHashSet(), tabuRelns, tabuTest); return descendantSet; }
/** * Performs a cull for the descendants of the given node in the * graph, subject to the tabu nodes to avoid, relations to avoid * crawling over, and child nodes to avoid traversing to based upon * a predicate test. */ private static void tabuDescendantsHelper(SemanticGraph sg, IndexedWord curr, Set<IndexedWord> descendantSet, Collection<IndexedWord> tabu, Collection<GrammaticalRelation> relnsToAvoid, Predicate<IndexedWord> tabuTest) { if (tabu.contains(curr)) return; if (descendantSet.contains(curr)) { return; } descendantSet.add(curr); for (IndexedWord child : sg.getChildren(curr)) { for (SemanticGraphEdge edge : sg.getAllEdges(curr, child)) { if (relnsToAvoid != null && relnsToAvoid.contains(edge.getRelation())) continue; if (tabuTest != null && tabuTest.test(edge.getDependent())) continue; tabuDescendantsHelper(sg, child, descendantSet, tabu, relnsToAvoid, tabuTest); } } }
/** * Performs a cull for the descendants of the given node in the * graph, subject to the tabu nodes to avoid, relations to avoid * crawling over, and child nodes to avoid traversing to based upon * a predicate test. */ private static void tabuDescendantsHelper(SemanticGraph sg, IndexedWord curr, Set<IndexedWord> descendantSet, Collection<IndexedWord> tabu, Collection<GrammaticalRelation> relnsToAvoid, BiPredicate<IndexedWord,SemanticGraph> tabuTest) { if (tabu.contains(curr)) return; if (descendantSet.contains(curr)) { return; } descendantSet.add(curr); for (IndexedWord child : sg.getChildren(curr)) { for (SemanticGraphEdge edge : sg.getAllEdges(curr, child)) { if (relnsToAvoid != null && relnsToAvoid.contains(edge.getRelation())) continue; if (tabuTest != null && tabuTest.test(edge.getDependent(), sg)) continue; tabuDescendantsHelper(sg, child, descendantSet, tabu, relnsToAvoid, tabuTest); } } }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabuNodes, Collection<GrammaticalRelation> tabuRelns, BiPredicate<IndexedWord,SemanticGraph> tabuTest) { if ( ! sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabuNodes, tabuRelns, tabuTest); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabuNodes, Collection<GrammaticalRelation> tabuRelns, Predicate<IndexedWord> tabuTest) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabuNodes, tabuRelns, tabuTest); return descendantSet; }
/** * Finds the descendents of the given node in graph, avoiding the given set of nodes */ public static Set<IndexedWord> tabuDescendants(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabu) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabu, null, (Predicate<IndexedWord>) null); return descendantSet; }
/** * Finds the set of descendants for a node in the graph, avoiding the set of nodes and the * set of edge relations. NOTE: these edges are encountered from the downward cull, * from governor to dependent. */ public static Set<IndexedWord> tabuDescendants(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabu, Collection<GrammaticalRelation> tabuRelns) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabu, tabuRelns, (Predicate<IndexedWord>) null); return descendantSet; }
/** * Finds the descendents of the given node in graph, avoiding the given set of nodes */ public static Set<IndexedWord> tabuDescendants(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabu) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabu, null, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabuNodes, Collection<GrammaticalRelation> tabuRelns, Predicate<IndexedWord> tabuTest) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabuNodes, tabuRelns, tabuTest); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabuNodes, Collection<GrammaticalRelation> tabuRelns, BiPredicate<IndexedWord,SemanticGraph> tabuTest) { if ( ! sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabuNodes, tabuRelns, tabuTest); return descendantSet; }
/** * Finds the set of descendants for a node in the graph, avoiding the set of nodes and the * set of edge relations. NOTE: these edges are encountered from the downward cull, * from governor to dependent. */ public static Set<IndexedWord> tabuDescendants(SemanticGraph sg, IndexedWord vertex, Collection<IndexedWord> tabu, Collection<GrammaticalRelation> tabuRelns) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, tabu, tabuRelns, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuRelns(SemanticGraph sg, IndexedWord vertex, Collection<GrammaticalRelation> tabuRelns) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, Generics.newHashSet(), tabuRelns, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<GrammaticalRelation> tabuRelns, Predicate<IndexedWord> tabuTest) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, Generics.newHashSet(), tabuRelns, tabuTest); return descendantSet; }
public static Set<IndexedWord> descendantsTabuRelns(SemanticGraph sg, IndexedWord vertex, Collection<GrammaticalRelation> tabuRelns) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, Generics.newHashSet(), tabuRelns, (Predicate<IndexedWord>) null); return descendantSet; }
public static Set<IndexedWord> descendantsTabuTestAndRelns(SemanticGraph sg, IndexedWord vertex, Collection<GrammaticalRelation> tabuRelns, Predicate<IndexedWord> tabuTest) { if (!sg.containsVertex(vertex)) { throw new IllegalArgumentException(); } // Do a depth first search Set<IndexedWord> descendantSet = Generics.newHashSet(); tabuDescendantsHelper(sg, vertex, descendantSet, Generics.newHashSet(), tabuRelns, tabuTest); return descendantSet; }