本文整理汇总了Java中com.google.javascript.jscomp.graph.LinkedDirectedGraph类的典型用法代码示例。如果您正苦于以下问题:Java LinkedDirectedGraph类的具体用法?Java LinkedDirectedGraph怎么用?Java LinkedDirectedGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkedDirectedGraph类属于com.google.javascript.jscomp.graph包,在下文中一共展示了LinkedDirectedGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSomeValidPaths
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests a graph where some paths between the nodes are valid and others
* are invalid.
*/
public void testSomeValidPaths() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.createDirectedGraphNode("e");
g.connect("a", "1", "b");
g.connect("b", "2", "c");
g.connect("b", "3", "e");
g.connect("e", "4", "d");
g.connect("c", "5", "d");
assertBad(createTest(g, "a", "d", Predicates.equalTo("c"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:andyjko,项目名称:feedlack,代码行数:22,代码来源:CheckPathsBetweenNodesTest.java
示例2: testManyValidPaths
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/** Tests a graph with many valid paths. */
public void testManyValidPaths() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c1");
g.createDirectedGraphNode("c2");
g.createDirectedGraphNode("c3");
DiGraphNode<String, String> d = g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c1");
g.connect("b", "-", "c2");
g.connect("c2", "-", "d");
g.connect("c1", "-", "d");
g.connect("a", "-", "c3");
g.connect("c3", "-", "d");
assertGood(createTest(g, "a", "d", new PrefixPredicate("c"), ALL_EDGE));
}
开发者ID:andyjko,项目名称:feedlack,代码行数:21,代码来源:CheckPathsBetweenNodesTest.java
示例3: testCycles1
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/** Tests a graph with some cycles. */
public void testCycles1() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.createDirectedGraphNode("e");
g.createDirectedGraphNode("f");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "d");
g.connect("d", "-", "e");
g.connect("e", "-", "f");
g.connect("f", "-", "b");
assertGood(createTest(g, "a", "e", Predicates.equalTo("b"), ALL_EDGE));
assertGood(createTest(g, "a", "e", Predicates.equalTo("c"), ALL_EDGE));
assertGood(createTest(g, "a", "e", Predicates.equalTo("d"), ALL_EDGE));
assertGood(createTest(g, "a", "e", Predicates.equalTo("e"), ALL_EDGE));
assertBad(createTest(g, "a", "e", Predicates.equalTo("f"), ALL_EDGE));
}
开发者ID:andyjko,项目名称:feedlack,代码行数:24,代码来源:CheckPathsBetweenNodesTest.java
示例4: testCycles2
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests another graph with cycles. The topology of this graph was inspired
* by a control flow graph that was being incorrectly analyzed by an early
* version of CheckPathsBetweenNodes.
*/
public void testCycles2() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "b");
g.connect("b", "-", "d");
assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:andyjko,项目名称:feedlack,代码行数:21,代码来源:CheckPathsBetweenNodesTest.java
示例5: testCycles3
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests another graph with cycles. The topology of this graph was inspired
* by a control flow graph that was being incorrectly analyzed by an early
* version of CheckPathsBetweenNodes.
*/
public void testCycles3() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "b");
g.connect("b", "-", "d");
g.connect("c", "-", "d");
assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:andyjko,项目名称:feedlack,代码行数:22,代码来源:CheckPathsBetweenNodesTest.java
示例6: testDirectedInAndOutEdges
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
public void testDirectedInAndOutEdges() {
DiGraph<String, String> graph =
new LinkedDirectedGraph<String, String>();
graph.createNode("a");
graph.createNode("b");
graph.createNode("c");
graph.createNode("d");
graph.connect("a", "->", "b");
graph.connect("a", "-->", "b");
graph.connect("a", "--->", "b");
graph.connect("a", "->", "c");
graph.connect("c", "->", "d");
assertSetEquals(graph.getDirectedSuccNodes("a"), "b", "c");
assertSetEquals(graph.getDirectedPredNodes("b"), "a");
assertSetEquals(graph.getDirectedPredNodes("c"), "a");
assertListCount(graph.getDirectedSuccNodes("a"), "b", 3);
// Removal.
graph.disconnect("a", "b");
assertFalse(graph.isConnected("a", "b"));
}
开发者ID:andyjko,项目名称:feedlack,代码行数:22,代码来源:GraphTest.java
示例7: setUp
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
@Override
public void setUp() {
A = new Counter();
B = new Counter();
C = new Counter();
D = new Counter();
E = new Counter();
graph = new LinkedDirectedGraph<Counter, String>();
graph.createDirectedGraphNode(A);
graph.createDirectedGraphNode(B);
graph.createDirectedGraphNode(C);
graph.createDirectedGraphNode(D);
graph.createDirectedGraphNode(E);
graph.connect(A, "->", B);
graph.connect(A, "->", C);
graph.connect(A, "->", D);
graph.connect(B, "->", D);
graph.connect(C, "->", E);
graph.connect(D, "->", E);
graph.connect(E, "->", D);
}
开发者ID:andyjko,项目名称:feedlack,代码行数:24,代码来源:FixedPointGraphTraversalTest.java
示例8: testGraph10
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
public void testGraph10() {
// Test a graph with self-edges.
maxChange = 5;
A = new Counter();
B = new Counter();
graph = new LinkedDirectedGraph<Counter, String>();
graph.createDirectedGraphNode(A);
graph.createDirectedGraphNode(B);
graph.connect(A, "->", A);
graph.connect(A, "->", B);
traversal.computeFixedPoint(graph);
assertEquals(6, A.value);
assertEquals(6, B.value);
}
开发者ID:andyjko,项目名称:feedlack,代码行数:20,代码来源:FixedPointGraphTraversalTest.java
示例9: testCycles2
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests another graph with cycles. The topology of this graph was inspired
* by a control flow graph that was being incorrectly analyzed by an early
* version of CheckPathsBetweenNodes.
*/
public void testCycles2() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "b");
g.connect("b", "-", "d");
assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:21,代码来源:CheckPathsBetweenNodesTest.java
示例10: testCycles3
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests another graph with cycles. The topology of this graph was inspired
* by a control flow graph that was being incorrectly analyzed by an early
* version of CheckPathsBetweenNodes.
*/
public void testCycles3() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "b");
g.connect("b", "-", "d");
g.connect("c", "-", "d");
assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:22,代码来源:CheckPathsBetweenNodesTest.java
示例11: testSomePath1
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Much of the tests are done by testing all paths. We quickly verified
* that some paths are indeed correct for the some path case.
*/
public void testSomePath1() {
DiGraph<String, String> g = new LinkedDirectedGraph<String, String>();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("a", "-", "c");
g.connect("b", "-", "d");
g.connect("c", "-", "d");
assertTrue(createTest(g, "a", "d", Predicates.equalTo("b"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertTrue(createTest(g, "a", "d", Predicates.equalTo("c"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertTrue(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertTrue(createTest(g, "a", "d", Predicates.equalTo("d"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertFalse(createTest(g, "a", "d", Predicates.equalTo("NONE"), ALL_EDGE)
.somePathsSatisfyPredicate());
}
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:28,代码来源:CheckPathsBetweenNodesTest.java
示例12: testSomeValidPaths
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests a graph where some paths between the nodes are valid and others
* are invalid.
*/
public void testSomeValidPaths() {
DiGraph<String, String> g = LinkedDirectedGraph.create();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.createDirectedGraphNode("e");
g.connect("a", "1", "b");
g.connect("b", "2", "c");
g.connect("b", "3", "e");
g.connect("e", "4", "d");
g.connect("c", "5", "d");
assertBad(createTest(g, "a", "d", Predicates.equalTo("c"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:CheckPathsBetweenNodesTest.java
示例13: testManyValidPaths
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/** Tests a graph with many valid paths. */
public void testManyValidPaths() {
DiGraph<String, String> g = LinkedDirectedGraph.create();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c1");
g.createDirectedGraphNode("c2");
g.createDirectedGraphNode("c3");
DiGraphNode<String, String> d = g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c1");
g.connect("b", "-", "c2");
g.connect("c2", "-", "d");
g.connect("c1", "-", "d");
g.connect("a", "-", "c3");
g.connect("c3", "-", "d");
assertGood(createTest(g, "a", "d", new PrefixPredicate("c"), ALL_EDGE));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:CheckPathsBetweenNodesTest.java
示例14: testCycles1
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/** Tests a graph with some cycles. */
public void testCycles1() {
DiGraph<String, String> g = LinkedDirectedGraph.create();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.createDirectedGraphNode("e");
g.createDirectedGraphNode("f");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "d");
g.connect("d", "-", "e");
g.connect("e", "-", "f");
g.connect("f", "-", "b");
assertGood(createTest(g, "a", "e", Predicates.equalTo("b"), ALL_EDGE));
assertGood(createTest(g, "a", "e", Predicates.equalTo("c"), ALL_EDGE));
assertGood(createTest(g, "a", "e", Predicates.equalTo("d"), ALL_EDGE));
assertGood(createTest(g, "a", "e", Predicates.equalTo("e"), ALL_EDGE));
assertBad(createTest(g, "a", "e", Predicates.equalTo("f"), ALL_EDGE));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:CheckPathsBetweenNodesTest.java
示例15: testCycles2
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests another graph with cycles. The topology of this graph was inspired
* by a control flow graph that was being incorrectly analyzed by an early
* version of CheckPathsBetweenNodes.
*/
public void testCycles2() {
DiGraph<String, String> g = LinkedDirectedGraph.create();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "b");
g.connect("b", "-", "d");
assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:CheckPathsBetweenNodesTest.java
示例16: testCycles3
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Tests another graph with cycles. The topology of this graph was inspired
* by a control flow graph that was being incorrectly analyzed by an early
* version of CheckPathsBetweenNodes.
*/
public void testCycles3() {
DiGraph<String, String> g = LinkedDirectedGraph.create();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("b", "-", "c");
g.connect("c", "-", "b");
g.connect("b", "-", "d");
g.connect("c", "-", "d");
assertGood(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE));
assertBad(createTest(g, "a", "d", Predicates.equalTo("z"), ALL_EDGE));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:CheckPathsBetweenNodesTest.java
示例17: testSomePath1
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
/**
* Much of the tests are done by testing all paths. We quickly verified
* that some paths are indeed correct for the some path case.
*/
public void testSomePath1() {
DiGraph<String, String> g = LinkedDirectedGraph.create();
g.createDirectedGraphNode("a");
g.createDirectedGraphNode("b");
g.createDirectedGraphNode("c");
g.createDirectedGraphNode("d");
g.connect("a", "-", "b");
g.connect("a", "-", "c");
g.connect("b", "-", "d");
g.connect("c", "-", "d");
assertTrue(createTest(g, "a", "d", Predicates.equalTo("b"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertTrue(createTest(g, "a", "d", Predicates.equalTo("c"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertTrue(createTest(g, "a", "d", Predicates.equalTo("a"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertTrue(createTest(g, "a", "d", Predicates.equalTo("d"), ALL_EDGE)
.somePathsSatisfyPredicate());
assertFalse(createTest(g, "a", "d", Predicates.equalTo("NONE"), ALL_EDGE)
.somePathsSatisfyPredicate());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:28,代码来源:CheckPathsBetweenNodesTest.java
示例18: setUp
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
@Override
public void setUp() {
A = new Counter();
B = new Counter();
C = new Counter();
D = new Counter();
E = new Counter();
graph = LinkedDirectedGraph.create();
graph.createDirectedGraphNode(A);
graph.createDirectedGraphNode(B);
graph.createDirectedGraphNode(C);
graph.createDirectedGraphNode(D);
graph.createDirectedGraphNode(E);
graph.connect(A, "->", B);
graph.connect(A, "->", C);
graph.connect(A, "->", D);
graph.connect(B, "->", D);
graph.connect(C, "->", E);
graph.connect(D, "->", E);
graph.connect(E, "->", D);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:FixedPointGraphTraversalTest.java
示例19: testGraph10
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
public void testGraph10() {
// Test a graph with self-edges.
maxChange = 5;
A = new Counter();
B = new Counter();
graph = LinkedDirectedGraph.create();
graph.createDirectedGraphNode(A);
graph.createDirectedGraphNode(B);
graph.connect(A, "->", A);
graph.connect(A, "->", B);
traversal.computeFixedPoint(graph);
assertEquals(6, A.value);
assertEquals(6, B.value);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:FixedPointGraphTraversalTest.java
示例20: testDirectedInAndOutEdges
import com.google.javascript.jscomp.graph.LinkedDirectedGraph; //导入依赖的package包/类
public void testDirectedInAndOutEdges() {
DiGraph<String, String> graph =
LinkedDirectedGraph.create();
graph.createNode("a");
graph.createNode("b");
graph.createNode("c");
graph.createNode("d");
graph.connect("a", "->", "b");
graph.connect("a", "-->", "b");
graph.connect("a", "--->", "b");
graph.connect("a", "->", "c");
graph.connect("c", "->", "d");
assertSetEquals(graph.getDirectedSuccNodes("a"), "b", "c");
assertSetEquals(graph.getDirectedPredNodes("b"), "a");
assertSetEquals(graph.getDirectedPredNodes("c"), "a");
assertListCount(graph.getDirectedSuccNodes("a"), "b", 3);
// Removal.
graph.disconnect("a", "b");
assertFalse(graph.isConnected("a", "b"));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:GraphTest.java
注:本文中的com.google.javascript.jscomp.graph.LinkedDirectedGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论