Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.DefaultFunctionInterpreter.registerFunction()


   * Test method for 'ca.nengo.math.impl.DefaultFunctionInterpreter.registerFunction(String, Function)'
   */
  public void testRegisterFunction() {
    Function c = new ConstantFunction(2, 1f);
    DefaultFunctionInterpreter interpreter = new DefaultFunctionInterpreter();
    interpreter.registerFunction("const", c);
    PostfixFunction f = (PostfixFunction) interpreter.parse("const(x0, x1)", 2);
    List<Serializable> l = f.getExpressionList();
    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals(c, l.get(2));
View Full Code Here


    assertEquals(Integer.valueOf(0), l.get(0));
    assertEquals(Integer.valueOf(1), l.get(1));
    assertEquals(c, l.get(2));
   
    try {
      interpreter.registerFunction("const", new ConstantFunction(1, 1f));
      fail("Should have thrown exception due to duplicate name");     
    } catch (Exception e) {} //exception is expected
  }

  /*
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.