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


Java JEP.getVar方法代码示例

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


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

示例1: testClone1

import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void testClone1() {
    JEP jepExpression = new JEP();
    jepExpression.setAllowUndeclared(true);
    jepExpression.addStandardConstants();
    jepExpression.addStandardFunctions();

    jepExpression.parseExpression("(a + 1) * (b - 3)");
    System.out.println("JEP: " + jepExpression);
    System.out.println(jepExpression.getTopNode().toLongString());
    System.out.println("Errori: " + jepExpression.getErrorInfo());
    Variable a = jepExpression.getVar("a");
    Variable b = jepExpression.getVar("b");
    jepExpression.setVarValue("a", 1);
    jepExpression.setVarValue("b", 2);
    System.out.println("Value: " + jepExpression.getValueAsObject());

    JEP clone = (JEP) jepExpression.clone();
    Variable aClone = clone.getVar("a");
    aClone.setDescription("a.a");
    Variable bClone = clone.getVar("b");
    bClone.setDescription("b.b");
    System.out.println(clone.getTopNode().toLongString());
    clone.setVarValue("a", 10);
    clone.setVarValue("b", 30);

    System.out.println("Value originale: " + jepExpression.getValueAsObject());
    System.out.println("Value clone: " + clone.getValueAsObject());

    System.out.println("Variable a originale: " + a.toString() + " - " + a.hashCode());
    System.out.println("Variable a clone: " + aClone.toString() + " - " + aClone.hashCode());

    System.out.println("Variable b originale: " + b.toString() + " - " + b.hashCode());
    System.out.println("Variable b clone: " + bClone.toString() + " - " + bClone.hashCode());

    System.out.println("Symbol table: " + jepExpression.getSymbolTable() + " - " + jepExpression.getSymbolTable().hashCode());
    System.out.println("Symbol table clone: " + clone.getSymbolTable() + " - " + clone.getSymbolTable().hashCode());
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:38,代码来源:TestExpressions.java

示例2: testClone2

import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void testClone2() {
    JEP jepExpression = new JEP();
    jepExpression.setAllowUndeclared(true);
    jepExpression.addStandardConstants();
    jepExpression.addStandardFunctions();

    jepExpression.parseExpression("log(a) + sin(b)");
    System.out.println("JEP: " + jepExpression);
    System.out.println(jepExpression.getTopNode().toLongString());
    Variable a = jepExpression.getVar("a");
    Variable b = jepExpression.getVar("b");
    jepExpression.setVarValue("a", 1);
    jepExpression.setVarValue("b", 2);
    System.out.println("Value: " + jepExpression.getValueAsObject());

    JEP clone = (JEP) jepExpression.clone();
    Variable aClone = clone.getVar("a");
    aClone.setDescription("a.a");
    Variable bClone = clone.getVar("b");
    bClone.setDescription("b.b");
    System.out.println(clone.getTopNode().toLongString());
    clone.setVarValue("a", 10);
    clone.setVarValue("b", 30);

    System.out.println("Value originale: " + jepExpression.getValueAsObject());
    System.out.println("Value clone: " + clone.getValueAsObject());

    System.out.println("Variable a originale: " + a.toString() + " - " + a.hashCode());
    System.out.println("Variable a clone: " + aClone.toString() + " - " + aClone.hashCode());

    System.out.println("Variable b originale: " + b.toString() + " - " + b.hashCode());
    System.out.println("Variable b clone: " + bClone.toString() + " - " + bClone.hashCode());

    System.out.println("Symbol table: " + jepExpression.getSymbolTable() + " - " + jepExpression.getSymbolTable().hashCode());
    System.out.println("Symbol table clone: " + clone.getSymbolTable() + " - " + clone.getSymbolTable().hashCode());
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:37,代码来源:TestExpressions.java

示例3: test4

import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test4() {
        JEP jepExpression = new JEP();
        jepExpression.setAllowUndeclared(true);
        jepExpression.addStandardConstants();
        jepExpression.addStandardFunctions();
//        jepExpression.parseExpression("((paolo + marco + giovanni) * log(franco) ) == 1.0");
        jepExpression.parseExpression("( ( (paolo + marco + giovanni) * log(franco) ) == 1.0 ) && (!luigi)");
        System.out.println("JEP: " + jepExpression);

        Variable a = jepExpression.getVar("paolo");
        a.setDescription("v2.paolo");
        System.out.println("JEP: " + jepExpression);
    }
 
开发者ID:dbunibas,项目名称:spicy,代码行数:14,代码来源:TestExpressions.java

示例4: testClonazione1

import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void testClonazione1() {
    JEP jepExpression = new JEP();
    jepExpression.setAllowUndeclared(true);
    jepExpression.addStandardConstants();
    jepExpression.addStandardFunctions();

    jepExpression.parseExpression("(a + 1) * (b - 3)");
    System.out.println("JEP: " + jepExpression);
    System.out.println(jepExpression.getTopNode().toLongString());
    System.out.println("Errori: " + jepExpression.getErrorInfo());
    Variable a = jepExpression.getVar("a");
    Variable b = jepExpression.getVar("b");
    jepExpression.setVarValue("a", 1);
    jepExpression.setVarValue("b", 2);
    System.out.println("Value: " + jepExpression.getValueAsObject());

    JEP clone = (JEP) jepExpression.clone();
    Variable aClone = clone.getVar("a");
    aClone.setDescription("a.a");
    Variable bClone = clone.getVar("b");
    bClone.setDescription("b.b");
    System.out.println(clone.getTopNode().toLongString());
    clone.setVarValue("a", 10);
    clone.setVarValue("b", 30);

    System.out.println("Value originale: " + jepExpression.getValueAsObject());
    System.out.println("Value clone: " + clone.getValueAsObject());

    System.out.println("Variable a originale: " + a.toString() + " - " + a.hashCode());
    System.out.println("Variable a clone: " + aClone.toString() + " - " + aClone.hashCode());

    System.out.println("Variable b originale: " + b.toString() + " - " + b.hashCode());
    System.out.println("Variable b clone: " + bClone.toString() + " - " + bClone.hashCode());

    System.out.println("Symbol table: " + jepExpression.getSymbolTable() + " - " + jepExpression.getSymbolTable().hashCode());
    System.out.println("Symbol table clone: " + clone.getSymbolTable() + " - " + clone.getSymbolTable().hashCode());
}
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:38,代码来源:TestEspressioni.java

示例5: testClonazione2

import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void testClonazione2() {
    JEP jepExpression = new JEP();
    jepExpression.setAllowUndeclared(true);
    jepExpression.addStandardConstants();
    jepExpression.addStandardFunctions();

    jepExpression.parseExpression("log(a) + sin(b)");
    System.out.println("JEP: " + jepExpression);
    System.out.println(jepExpression.getTopNode().toLongString());
    Variable a = jepExpression.getVar("a");
    Variable b = jepExpression.getVar("b");
    jepExpression.setVarValue("a", 1);
    jepExpression.setVarValue("b", 2);
    System.out.println("Value: " + jepExpression.getValueAsObject());

    JEP clone = (JEP) jepExpression.clone();
    Variable aClone = clone.getVar("a");
    aClone.setDescription("a.a");
    Variable bClone = clone.getVar("b");
    bClone.setDescription("b.b");
    System.out.println(clone.getTopNode().toLongString());
    clone.setVarValue("a", 10);
    clone.setVarValue("b", 30);

    System.out.println("Value originale: " + jepExpression.getValueAsObject());
    System.out.println("Value clone: " + clone.getValueAsObject());

    System.out.println("Variable a originale: " + a.toString() + " - " + a.hashCode());
    System.out.println("Variable a clone: " + aClone.toString() + " - " + aClone.hashCode());

    System.out.println("Variable b originale: " + b.toString() + " - " + b.hashCode());
    System.out.println("Variable b clone: " + bClone.toString() + " - " + bClone.hashCode());

    System.out.println("Symbol table: " + jepExpression.getSymbolTable() + " - " + jepExpression.getSymbolTable().hashCode());
    System.out.println("Symbol table clone: " + clone.getSymbolTable() + " - " + clone.getSymbolTable().hashCode());
}
 
开发者ID:donatellosantoro,项目名称:Llunatic,代码行数:37,代码来源:TestEspressioni.java


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