Package org.allspice.structured.statement

Examples of org.allspice.structured.statement.ReturnStatement


    public int meth(boolean arg0) ;
  }
  public void test1() throws Exception {
    IfTest obj = makeObject(IfTest.class,new IfThenElseStatement(
        ARG0,
        new FIFO<Statement>(new ReturnStatement(new ConstExpr(Integer.valueOf(3),null),null)),
        new FIFO<Statement>(new ReturnStatement(new ConstExpr(Integer.valueOf(2),null),null)),
        null)) ;
    assertEquals(obj.meth(true),3) ;
    assertEquals(obj.meth(false),2) ;
  }
View Full Code Here


                  new ConstExpr(Integer.valueOf(5),null),
                  new ConstExpr(Integer.valueOf(7),null)
                  )))
              ),
            false)),
        new FIFO<Statement>(new ReturnStatement(new VarExpr("i",null),null)),
        null
      )) ;
    final int[][] meth = obj.meth();
    assertTrue(Arrays.deepEquals(meth,new int[][]{{6,9},{5,7}})) ;
  }
View Full Code Here

  }
  public void test1() throws Exception {
    SwitchTest obj = makeObject(SwitchTest.class,new SwitchStatement(ARG0,
        new FIFO<Statement>(
        new CaseStatement(new ConstExpr(Integer.valueOf(1),null),null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(2),null),null),
        new CaseStatement(new ConstExpr(Integer.valueOf(0),null),null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(0),null),null),
        new CaseStatement(new ConstExpr(Integer.valueOf(2),null),null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(4),null),null),
        new CaseStatement(null,null),
        new ReturnStatement(new ConstExpr(Integer.valueOf(-1),null),null)
    ),null)) ;
    assertEquals(obj.meth(0),0) ;
    assertEquals(obj.meth(1),2) ;
    assertEquals(obj.meth(2),4) ;
    assertEquals(obj.meth(3),-1) ;
View Full Code Here

        new WhileStatement(
            new LTExpr(I,ARG0,null),
            new FIFO<Statement>(
            new ExprStatement(new AddInPlaceExpr(I,new ConstExpr(Integer.valueOf(1),null),null),null),
            new ExprStatement(new AddInPlaceExpr(TOTAL,new ConstExpr(Integer.valueOf(2),null),null),null)),null),
        new ReturnStatement(TOTAL,null)
      ),null)) ;
    assertEquals(obj.meth(5),10) ;
    assertEquals(obj.meth(0),0) ;
  }
View Full Code Here

    ClassLoader loader = ClassConverter.createLoader(StdJavaExpressions.INSTANCE,new FIFO<FileUnit>(fu)) ;
    Class<?> cl = loader.loadClass(ClassPool.getClassName(fu,cd).toString()) ;
    return (T)cl.newInstance() ;   
  }
  public <T> T makeObject(Class<T> iface,Expr e) throws Exception {
    return makeObject(iface,new ReturnStatement(e,null)) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.structured.statement.ReturnStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.