本文整理汇总了Java中org.nfunk.jep.JEP.setAllowUndeclared方法的典型用法代码示例。如果您正苦于以下问题:Java JEP.setAllowUndeclared方法的具体用法?Java JEP.setAllowUndeclared怎么用?Java JEP.setAllowUndeclared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nfunk.jep.JEP
的用法示例。
在下文中一共展示了JEP.setAllowUndeclared方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClone3
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void testClone3() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("append(a, b, c)");
System.out.println("JEP: " + jepExpression);
System.out.println(jepExpression.getTopNode().toLongString());
jepExpression.setVarValue("a", "Uno");
jepExpression.setVarValue("b", "Due");
jepExpression.setVarValue("c", "Tre");
System.out.println("Value: " + jepExpression.getValueAsObject());
JEP clone = (JEP) jepExpression.clone();
clone.setVarValue("a", "Dieci");
clone.setVarValue("b", "Undici");
clone.setVarValue("c", "Dodici");
System.out.println("Value originale: " + jepExpression.getValueAsObject());
System.out.println("Value clone: " + clone.getValueAsObject());
}
示例2: test6
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test6() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("year > 1980");
System.out.println("JEP: " + jepExpression);
jepExpression.setVarValue("year", 1981);
Object value1 = jepExpression.getValueAsObject();
System.out.println("Value: " + value1);
assertEquals(1.0, value1);
jepExpression.setVarValue("year", 1971);
Object value2 = jepExpression.getValueAsObject();
System.out.println("Value: " + value2);
assertEquals(0.0, value2);
jepExpression.setVarValue("year", "1971");
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例3: testClonazione3
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void testClonazione3() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("append(a, b, c)");
System.out.println("JEP: " + jepExpression);
System.out.println(jepExpression.getTopNode().toLongString());
jepExpression.setVarValue("a", "Uno");
jepExpression.setVarValue("b", "Due");
jepExpression.setVarValue("c", "Tre");
System.out.println("Value: " + jepExpression.getValueAsObject());
JEP clone = (JEP) jepExpression.clone();
clone.setVarValue("a", "Dieci");
clone.setVarValue("b", "Undici");
clone.setVarValue("c", "Dodici");
System.out.println("Value originale: " + jepExpression.getValueAsObject());
System.out.println("Value clone: " + clone.getValueAsObject());
}
示例4: Expression
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public Expression(String expression) throws ExpressionSyntaxException {
jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression(expression);
if (jepExpression.hasError()) {
throw new ExpressionSyntaxException(jepExpression.getErrorInfo());
}
if (logger.isDebugEnabled()) logger.debug("Created expression: " + jepExpression);
}
示例5: 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());
}
示例6: 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());
}
示例7: 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);
}
示例8: test5
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test5() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("append(\"abc\", \"def\")");
System.out.println("JEP: " + jepExpression);
System.out.println("Value: " + jepExpression.getValueAsObject());
jepExpression.parseExpression(jepExpression.toString());
System.out.println("JEP: " + jepExpression);
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例9: test7
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test7() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("newId()");
System.out.println("JEP: " + jepExpression);
System.out.println("Value: " + jepExpression.getValueAsObject());
System.out.println("Value: " + jepExpression.getValueAsObject());
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例10: test8
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test8() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("date()");
System.out.println("JEP: " + jepExpression);
System.out.println("Value: " + jepExpression.getValueAsObject());
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例11: test9
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test9() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("\"AAA\"");
System.out.println("JEP: " + jepExpression);
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例12: test10
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test10() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("split(S, Sep, X)");
System.out.println("JEP: " + jepExpression);
jepExpression.setVarValue("S", "Mario, Rossi");
jepExpression.setVarValue("Sep", ", ");
jepExpression.setVarValue("X", 1);
System.out.println(jepExpression.getTopNode().toLongString());
System.out.println(jepExpression.getErrorInfo());
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例13: test11
import org.nfunk.jep.JEP; //导入方法依赖的package包/类
public void test11() {
JEP jepExpression = new JEP();
jepExpression.setAllowUndeclared(true);
jepExpression.addStandardConstants();
jepExpression.addStandardFunctions();
jepExpression.parseExpression("substring(\"prova\", 2)");
System.out.println("JEP: " + jepExpression);
System.out.println(jepExpression.getTopNode().toLongString());
System.out.println(jepExpression.getErrorInfo());
System.out.println("Value: " + jepExpression.getValueAsObject());
}
示例14: 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());
}
示例15: 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());
}