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


Java Plan.parse方法代码示例

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


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

示例1: setUp

import jason.asSyntax.Plan; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();
    
    intention1 = new Intention();
    Plan p = Plan.parse("+!g0 : true <- !g1; !g4.");
    intention1.push(new IntendedMeans(new Option(p,new Unifier()), null));
    
    p = Plan.parse("+!g1 : true <- !g2.");
    intention1.push(new IntendedMeans(new Option(p,new Unifier()), null));

    p = Plan.parse("+!g2 : true <- !g4; f;g.");
    intention1.push(new IntendedMeans(new Option(p,new Unifier()), null));
    
    p4 = Plan.parse("+!g4 : true <- h.");
    intention1.push(new IntendedMeans(new Option(p4,new Unifier()), null));

    p5 = Plan.parse("+!g5 : true <- i.");
    
    ag = new Agent();
    ag.initAg();
    ag.getPL().add(Plan.parse("-!g1 : true <- j."));
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:23,代码来源:StdLibTest.java

示例2: setUp

import jason.asSyntax.Plan; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();

    intention1 = new Intention();
    Plan p = Plan.parse("+!g0 : true <- !g1; !g4.");
    intention1.push(new IntendedMeans(new Option(p,new Unifier()), null));

    p = Plan.parse("+!g1 : true <- !g2.");
    intention1.push(new IntendedMeans(new Option(p,new Unifier()), null));

    p = Plan.parse("+!g2 : true <- !g4; f;g.");
    intention1.push(new IntendedMeans(new Option(p,new Unifier()), null));

    p4 = Plan.parse("+!g4 : true <- h.");
    intention1.push(new IntendedMeans(new Option(p4,new Unifier()), null));

    p5 = Plan.parse("+!g5 : true <- i.");

    ag = new Agent();
    ag.initAg();
    ag.getPL().add(Plan.parse("-!g1 : true <- j."));
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:23,代码来源:StdLibTest.java

示例3: testAnnots

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testAnnots() {
    Plan p1 = Plan.parse("@l[atomic,breakpoint] +e.");
    Plan p2 = Plan.parse("+e : c <- a.");
    assertTrue(p1.isAtomic());
    assertFalse(p2.isAtomic());
    assertTrue(p1.hasBreakpoint());
    assertFalse(p2.hasBreakpoint());

    Plan p3 = (Plan) p1.clone();
    assertTrue(p3.isAtomic());
    assertTrue(p3.hasBreakpoint());
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:13,代码来源:PlanTest.java

示例4: testDelete

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testDelete() {
    Plan p = Plan.parse("+te : a & b <- !a1; ?a2; .print(a); !g1.");
    assertEquals(4, p.getBody().getPlanSize());
    p.getBody().removeBody(0);
    assertEquals(3, p.getBody().getPlanSize());
    assertEquals(PlanBody.BodyType.test, p.getBody().getBodyType());
    p.getBody().removeBody(0); // 2
    p.getBody().removeBody(0); // 1
    assertEquals(1, p.getBody().getPlanSize());
    p.getBody().removeBody(0); // 1
    assertTrue(p.getBody().isEmptyBody());
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:13,代码来源:PlanTest.java

示例5: testEqualsBodyLiteral

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testEqualsBodyLiteral() {
    PlanBody bl = new PlanBodyImpl(BodyType.achieve, new LiteralImpl("g1"));
    VarTerm v = new VarTerm("X");
    Unifier u = new Unifier();
    // X = !g1
    assertTrue(u.unifies(v, bl));
    PlanBody vb = (PlanBody)v.capply(u);
    assertEquals(BodyType.achieve, vb.getBodyType());
    assertEquals(bl.getBodyTerm(),vb.getBodyTerm());
    Plan p = Plan.parse("+te : a & b <- !g1.");
    assertEquals(p.getBody(),vb);
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:13,代码来源:PlanTest.java

示例6: testUnifyBody

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testUnifyBody() {
    Plan p1 = Plan.parse("+te : a & b <- !a1; ?a2; .print(a); !g1.");
    PlanBody bl = new PlanBodyImpl(BodyType.action, new VarTerm("A1"));
    bl.add(new PlanBodyImpl(BodyType.action, new VarTerm("A2")));
    bl.add(new PlanBodyImpl(BodyType.action, new VarTerm("A3")));
    //assertEquals(p1.getBody().getArity(), bl.getArity());
    Unifier u = new Unifier();
    assertTrue(u.unifies(p1.getBody(), bl));
    assertEquals("a1", u.get("A1").toString());
    assertEquals("a2", u.get("A2").toString());
    assertEquals(".print(a); !g1", u.get("A3").toString());  
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:13,代码来源:PlanTest.java

示例7: testUnifyBody

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testUnifyBody() {
    Plan p1 = Plan.parse("+te : a & b <- !a1; ?a2; .print(a); !g1.");
    PlanBody bl = new PlanBodyImpl(BodyType.action, new VarTerm("A1"));
    bl.add(new PlanBodyImpl(BodyType.action, new VarTerm("A2")));
    bl.add(new PlanBodyImpl(BodyType.action, new VarTerm("A3")));
    //assertEquals(p1.getBody().getArity(), bl.getArity());
    Unifier u = new Unifier();
    assertTrue(u.unifies(p1.getBody(), bl));
    assertEquals("a1", u.get("A1").toString());
    assertEquals("a2", u.get("A2").toString());
    assertEquals(".print(a); !g1", u.get("A3").toString());
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:13,代码来源:PlanTest.java

示例8: testSingletonVars

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testSingletonVars() {
    Literal l = Literal.parseLiteral("a(10)");
    assertEquals(0, l.getSingletonVars().size());
    
    l = Literal.parseLiteral("a(X)");
    assertEquals(1, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(X,X)");
    assertEquals(0, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(_X,_Y,_X)");
    assertEquals(0, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(X,Y,b(g(X),c))");
    assertEquals(1, l.getSingletonVars().size());
    assertEquals("Y", l.getSingletonVars().get(0).toString());

    l = Literal.parseLiteral("a(X,Y,b(g(X),c))[b,source(Y)]");
    assertEquals(0, l.getSingletonVars().size());
    
    l = Literal.parseLiteral("a(Test,X,Y,b(g(X),c))[b,source(Y),B,kk(U)]");
    assertEquals(3, l.getSingletonVars().size());
    
    l = Literal.parseLiteral("a(Test,X,Y,b(g([V1,X,V2,V1]),c))[b,source(Y),B,kk(_)]");
    assertEquals(3, l.getSingletonVars().size());

    Plan p = Plan.parse("+e(X) : X > 10 <- .print(ok).");
    assertEquals(0, p.getSingletonVars().size());
    
    p = Plan.parse("+e(x) : X > 10 <- .print(ok).");
    assertEquals(1, p.getSingletonVars().size());
    assertEquals("X", p.getSingletonVars().get(0).toString());

    p = Plan.parse("+e(x) : a(X) & X > 10 <- .print(ok).");
    assertEquals(0, p.getSingletonVars().size());
    
    p = Plan.parse("+e(x) : a(X) & X > 10 <- .print(W).");
    assertEquals(1, p.getSingletonVars().size());
    
    p = Plan.parse("+e(x) : a(X, { +!g(W) <- true }) & X > 10 <- .print(W).");
    assertEquals(0, p.getSingletonVars().size());

    p = Plan.parse("+e(x) : a(X) & X > 10 <- .print(_).");
    assertEquals(0, p.getSingletonVars().size());
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:46,代码来源:TermTest.java

示例9: testSingletonVars

import jason.asSyntax.Plan; //导入方法依赖的package包/类
public void testSingletonVars() {
    Literal l = Literal.parseLiteral("a(10)");
    assertEquals(0, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(X)");
    assertEquals(1, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(X,X)");
    assertEquals(0, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(_X,_Y,_X)");
    assertEquals(0, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(X,Y,b(g(X),c))");
    assertEquals(1, l.getSingletonVars().size());
    assertEquals("Y", l.getSingletonVars().get(0).toString());

    l = Literal.parseLiteral("a(X,Y,b(g(X),c))[b,source(Y)]");
    assertEquals(0, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(Test,X,Y,b(g(X),c))[b,source(Y),B,kk(U)]");
    assertEquals(3, l.getSingletonVars().size());

    l = Literal.parseLiteral("a(Test,X,Y,b(g([V1,X,V2,V1]),c))[b,source(Y),B,kk(_)]");
    assertEquals(3, l.getSingletonVars().size());

    Plan p = Plan.parse("+e(X) : X > 10 <- .print(ok).");
    assertEquals(0, p.getSingletonVars().size());

    p = Plan.parse("+e(x) : X > 10 <- .print(ok).");
    assertEquals(1, p.getSingletonVars().size());
    assertEquals("X", p.getSingletonVars().get(0).toString());

    p = Plan.parse("+e(x) : a(X) & X > 10 <- .print(ok).");
    assertEquals(0, p.getSingletonVars().size());

    p = Plan.parse("+e(x) : a(X) & X > 10 <- .print(W).");
    assertEquals(1, p.getSingletonVars().size());

    p = Plan.parse("+e(x) : a(X, { +!g(W) <- true }) & X > 10 <- .print(W).");
    assertEquals(0, p.getSingletonVars().size());

    p = Plan.parse("+e(x) : a(X) & X > 10 <- .print(_).");
    assertEquals(0, p.getSingletonVars().size());
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:46,代码来源:TermTest.java


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