本文整理汇总了Java中org.jgrapht.Graphs.predecessorListOf方法的典型用法代码示例。如果您正苦于以下问题:Java Graphs.predecessorListOf方法的具体用法?Java Graphs.predecessorListOf怎么用?Java Graphs.predecessorListOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgrapht.Graphs
的用法示例。
在下文中一共展示了Graphs.predecessorListOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBoundVariables
import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<IVariable> getBoundVariables(final ILiteral literal) {
if (literal == null) {
throw new IllegalArgumentException("The literal must not be null");
}
if (!sipGraph.containsVertex(literal)) {
return Collections.<IVariable>emptySet();
}
final Set<IVariable> variables = new HashSet<IVariable>();
for (final ILiteral predicate : Graphs.predecessorListOf(sipGraph, literal)) {
variables.addAll(sipGraph.getEdge(predicate, literal).getLabel());
}
return variables;
}
示例2: getDepends
import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<ILiteral> getDepends(final ILiteral literal) {
final Set<ILiteral> dependencies = new HashSet<ILiteral>();
final Set<ILiteral> todoDependencies = new HashSet<ILiteral>();
if (literal == null) {
throw new IllegalArgumentException("The literal must not be null");
}
if (!sipGraph.containsVertex(literal)) {
return Collections.<ILiteral>emptySet();
}
todoDependencies.add(literal);
while (!todoDependencies.isEmpty()) {
final ILiteral actual = todoDependencies.iterator().next();
todoDependencies.remove(actual);
for (final ILiteral vertex : Graphs.predecessorListOf(sipGraph, actual)) {
if (dependencies.add(vertex)) {
todoDependencies.add(vertex);
}
}
}
return dependencies;
}
示例3: getEdgesEnteringLiteral
import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<LabeledEdge<ILiteral, Set<IVariable>>> getEdgesEnteringLiteral(
final ILiteral literal) {
if (literal == null) {
throw new IllegalArgumentException("The literal must not be null");
}
if (!sipGraph.containsVertex(literal)) {
return Collections.<LabeledEdge<ILiteral, Set<IVariable>>>emptySet();
}
final List<ILiteral> predecessors = Graphs.predecessorListOf(sipGraph, literal);
final Set<LabeledEdge<ILiteral, Set<IVariable>>> edges =
new HashSet<LabeledEdge<ILiteral, Set<IVariable>>>(predecessors.size());
for (final ILiteral predecessor : predecessors) {
edges.add(sipGraph.getEdge(predecessor, literal));
}
return edges;
}
示例4: getDepends
import org.jgrapht.Graphs; //导入方法依赖的package包/类
public Set<IPredicate> getDepends(final IPredicate p) {
if (p == null) {
throw new NullPointerException("The predicate must not be null");
}
if (!g.containsVertex(p)) {
return Collections.EMPTY_SET;
}
final Set<IPredicate> todo = new HashSet<IPredicate>();
todo.add(p);
final Set<IPredicate> deps = new HashSet<IPredicate>();
while (!todo.isEmpty()) {
final IPredicate act = todo.iterator().next();
todo.remove(act);
for (final IPredicate depends : Graphs.predecessorListOf(g, act)) {
if (deps.add(depends)) {
todo.add(depends);
}
}
}
return deps;
}
示例5: directImportersOf
import org.jgrapht.Graphs; //导入方法依赖的package包/类
/**
* @see msi.gama.lang.gaml.indexer.IModelIndexer#directImportersOf(org.eclipse.emf.common.util.URI)
*/
public static Set<URI> directImportersOf(final URI uri) {
final URI newURI = GamlResourceServices.properlyEncodedURI(uri);
if (index.containsVertex(newURI))
return new HashSet(Graphs.predecessorListOf(index, newURI));
return Collections.EMPTY_SET;
}