当前位置: 首页>>代码示例>>Java>>正文


Java TraversalStrategies.addStrategies方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies.addStrategies方法的典型用法代码示例。如果您正苦于以下问题:Java TraversalStrategies.addStrategies方法的具体用法?Java TraversalStrategies.addStrategies怎么用?Java TraversalStrategies.addStrategies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies的用法示例。


在下文中一共展示了TraversalStrategies.addStrategies方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWellDefinedDependency3

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testWellDefinedDependency3() {
    //Dependency well defined
    TraversalStrategies s = new DefaultTraversalStrategies();
    s.addStrategies(d, c, a, e, b);
    assertEquals(5, s.toList().size());
    assertEquals(a, s.toList().get(0));
    assertEquals(b, s.toList().get(1));
    assertEquals(d, s.toList().get(2));
    assertEquals(c, s.toList().get(3));
    assertEquals(e, s.toList().get(4));
    s = s.clone();
    assertEquals(5, s.toList().size());
    assertEquals(a, s.toList().get(0));
    assertEquals(b, s.toList().get(1));
    assertEquals(d, s.toList().get(2));
    assertEquals(c, s.toList().get(3));
    assertEquals(e, s.toList().get(4));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:DefaultTraversalStrategiesTest.java

示例2: shouldBeVerifiedIllegal

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {

    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(ComputerVerificationStrategy.instance());
    this.traversal.asAdmin().setParent(new TraversalVertexProgramStep(EmptyTraversal.instance(), EmptyTraversal.instance())); // trick it
    this.traversal.asAdmin().setStrategies(strategies);
    try {
        this.traversal.asAdmin().applyStrategies();
        if (!this.legal)
            fail("The traversal should not be allowed: " + this.traversal);
    } catch (final VerificationException ise) {
        if (this.legal)
            fail("The traversal should be allowed: " + this.traversal);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:ComputerVerificationStrategyTest.java

示例3: shouldBeVerifiedIllegal

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(LambdaRestrictionStrategy.instance());
    traversal.asAdmin().setStrategies(strategies);
    if (allow) {
        traversal.asAdmin().applyStrategies();
    } else {
        try {
            traversal.asAdmin().applyStrategies();
            fail("The strategy should not allow lambdas: " + this.traversal);
        } catch (VerificationException ise) {
            assertTrue(ise.getMessage().contains("lambda"));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:LambdaRestrictionStrategyTest.java

示例4: shouldBeVerifiedIllegal

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(ProfileStrategy.instance());
    strategies.addStrategies(LambdaRestrictionStrategy.instance());
    traversal.asAdmin().setStrategies(strategies);
    if (allow) {
        traversal.asAdmin().applyStrategies();
    } else {
        try {
            traversal.asAdmin().applyStrategies();
            fail("The strategy should not allow lambdas: " + this.traversal);
        } catch (VerificationException ise) {
            assertTrue(ise.getMessage().contains("lambda"));
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:LambdaRestrictionStrategyTest.java

示例5: doTest

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void doTest() {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(TinkerGraphCountStrategy.instance());
    for (final TraversalStrategy strategy : this.otherStrategies) {
        strategies.addStrategies(strategy);
    }
    this.original.asAdmin().setStrategies(strategies);
    this.original.asAdmin().applyStrategies();
    assertEquals(this.optimized, this.original);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:12,代码来源:TinkerGraphCountStrategyTest.java

示例6: doTest

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void doTest() {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(TinkerGraphStepStrategy.instance());
    for (final TraversalStrategy strategy : this.otherStrategies) {
        strategies.addStrategies(strategy);
    }
    this.original.asAdmin().setStrategies(strategies);
    this.original.asAdmin().applyStrategies();
    assertEquals(this.optimized, this.original);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:12,代码来源:TinkerGraphStepStrategyTest.java

示例7: TraversalExplanation

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
public TraversalExplanation(final Traversal.Admin<?, ?> traversal) {
    this.traversal = traversal.clone();
    TraversalStrategies mutatingStrategies = new DefaultTraversalStrategies();
    for (final TraversalStrategy strategy : this.traversal.getStrategies().toList()) {
        final Traversal.Admin<?, ?> mutatingTraversal = this.traversal.clone();
        mutatingStrategies.addStrategies(strategy);
        mutatingTraversal.setStrategies(mutatingStrategies);
        mutatingTraversal.applyStrategies();
        this.strategyTraversals.add(Pair.with(strategy, mutatingTraversal));
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:TraversalExplanation.java

示例8: doTest

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void doTest() {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(new VertexProgramStrategy(Computer.compute()), ComputerVerificationStrategy.instance());
    original.asAdmin().setStrategies(strategies);
    original.asAdmin().applyStrategies();
    assertEquals(optimized, original);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:VertexProgramStrategyTest.java

示例9: addRequirements

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
public static void addRequirements(final TraversalStrategies traversalStrategies, final TraverserRequirement... requirements) {
    RequirementsStrategy strategy = (RequirementsStrategy) traversalStrategies.toList().stream().filter(s -> s instanceof RequirementsStrategy).findAny().orElse(null);
    if (null == strategy) {
        strategy = new RequirementsStrategy();
        traversalStrategies.addStrategies(strategy);
    } else {
        final RequirementsStrategy cloneStrategy = new RequirementsStrategy();
        cloneStrategy.requirements.addAll(strategy.requirements);
        strategy = cloneStrategy;
        traversalStrategies.addStrategies(strategy);
    }
    Collections.addAll(strategy.requirements, requirements);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:RequirementsStrategy.java

示例10: testWellDefinedDependency

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testWellDefinedDependency() {
    //Dependency well defined
    TraversalStrategies s = new DefaultTraversalStrategies();
    s.addStrategies(b, a);
    assertEquals(2, s.toList().size());
    assertEquals(a, s.toList().get(0));
    assertEquals(b, s.toList().get(1));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:DefaultTraversalStrategiesTest.java

示例11: testNoDependency

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testNoDependency() {
    //No dependency
    TraversalStrategies s = new DefaultTraversalStrategies();
    s.addStrategies(c, a);
    assertEquals(2, s.toList().size());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:8,代码来源:DefaultTraversalStrategiesTest.java

示例12: shouldBeVerifiedIllegal

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void shouldBeVerifiedIllegal() {
    try {
        final TraversalStrategies strategies = new DefaultTraversalStrategies();
        strategies.addStrategies(StandardVerificationStrategy.instance());
        traversal.asAdmin().setStrategies(strategies);
        traversal.asAdmin().applyStrategies();
        fail("The strategy should not allow traversal: " + this.traversal);
    } catch (IllegalStateException ise) {
        assertTrue(true);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:13,代码来源:StandardVerificationStrategyTest.java

示例13: testCircularDependency

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testCircularDependency() {
    //Circular dependency => throws exception
    TraversalStrategies s = new DefaultTraversalStrategies();
    try {
        s.addStrategies(c, k, a, b);
        fail();
    } catch (IllegalStateException ex) {
        assertTrue(ex.getMessage().toLowerCase().contains("cyclic"));
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:DefaultTraversalStrategiesTest.java

示例14: testCircularDependency2

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testCircularDependency2() {
    //Circular dependency => throws exception
    TraversalStrategies s = new DefaultTraversalStrategies();
    try {
        s.addStrategies(d, c, k, a, e, b);
        fail();
    } catch (IllegalStateException ex) {
        assertTrue(ex.getMessage().toLowerCase().contains("cyclic"));
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:DefaultTraversalStrategiesTest.java

示例15: testLotsOfStrategies

import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; //导入方法依赖的package包/类
@Test
public void testLotsOfStrategies() {
    //Lots of strategies
    TraversalStrategies s = new DefaultTraversalStrategies();
    s = s.addStrategies(b, l, m, n, o, a);
    assertTrue(s.toList().indexOf(a) < s.toList().indexOf(b));
    s = s.clone();
    assertTrue(s.toList().indexOf(a) < s.toList().indexOf(b));

    // sort and then add more
    s = new DefaultTraversalStrategies();
    s.addStrategies(b, a, c);
    assertEquals(3, s.toList().size());
    assertEquals(a, s.toList().get(0));
    assertEquals(b, s.toList().get(1));
    assertEquals(c, s.toList().get(2));
    s.addStrategies(d);
    s = s.clone();
    assertEquals(4, s.toList().size());
    assertEquals(a, s.toList().get(0));
    assertEquals(b, s.toList().get(1));
    assertEquals(d, s.toList().get(2));
    assertEquals(c, s.toList().get(3));
    s.addStrategies(e);
    assertEquals(5, s.toList().size());
    assertEquals(a, s.toList().get(0));
    assertEquals(b, s.toList().get(1));
    assertEquals(d, s.toList().get(2));
    assertEquals(c, s.toList().get(3));
    assertEquals(e, s.toList().get(4));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:32,代码来源:DefaultTraversalStrategiesTest.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies.addStrategies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。