use of com.googlecode.aviator.runtime.function.system.BinaryFunction in project aviatorscript by killme2008.
the class FunctionUtilsUnitTest method testGetFunction_neg.
@Test
public void testGetFunction_neg() {
AviatorFunction fun = FunctionUtils.getFunction(new AviatorJavaType("-"), AviatorEvaluator.FUNC_MAP, 1);
assertNotNull(fun);
assertTrue(fun instanceof BinaryFunction);
assertEquals("-neg", fun.getName());
assertEquals(OperatorType.NEG, ((BinaryFunction) fun).getOpType());
}
use of com.googlecode.aviator.runtime.function.system.BinaryFunction in project aviatorscript by killme2008.
the class FunctionUtilsUnitTest method testGetFunction_sub.
@Test
public void testGetFunction_sub() {
AviatorFunction fun = FunctionUtils.getFunction(new AviatorJavaType("-"), AviatorEvaluator.FUNC_MAP, 2);
assertNotNull(fun);
assertTrue(fun instanceof BinaryFunction);
assertEquals("-sub", fun.getName());
assertEquals(OperatorType.SUB, ((BinaryFunction) fun).getOpType());
}
use of com.googlecode.aviator.runtime.function.system.BinaryFunction in project aviatorscript by killme2008.
the class AviatorEvaluatorInstance method loadSystemFunctions.
private void loadSystemFunctions() {
addFunction(ComparatorFunction.INSTANCE);
addFunction(new CompareFunction());
addFunction(new SysDateFunction());
addFunction(new PrintlnFunction());
addFunction(new PrintFunction());
addFunction(new PstFunction());
addFunction(new RandomFunction());
addFunction(new NowFunction());
addFunction(new LongFunction());
addFunction(new BooleanFunction());
addFunction(new DoubleFunction());
addFunction(new StrFunction());
addFunction(new BigIntFunction());
addFunction(new DecimalFunction());
addFunction(new Date2StringFunction());
addFunction(new String2DateFunction());
addFunction(new BinaryFunction(OperatorType.ADD));
addFunction(new BinaryFunction(OperatorType.Exponent));
addFunction(new BinaryFunction(OperatorType.SUB));
addFunction(new BinaryFunction(OperatorType.MULT));
addFunction(new BinaryFunction(OperatorType.DIV));
addFunction(new BinaryFunction(OperatorType.MOD));
addFunction(new BinaryFunction(OperatorType.NEG));
addFunction(new BinaryFunction(OperatorType.NOT));
addFunction(new BinaryFunction(OperatorType.BIT_AND));
addFunction(new BinaryFunction(OperatorType.BIT_OR));
addFunction(new BinaryFunction(OperatorType.BIT_XOR));
addFunction(new BinaryFunction(OperatorType.BIT_NOT));
addFunction(new TupleFunction());
addFunction(new MinFunction());
addFunction(new MaxFunction());
addFunction(new IdentityFunction());
addFunction(new AssertFunction());
addFunction(new RangeFunction());
addFunction(new IsDefFunction());
addFunction(new UndefFunction());
addFunction(new TypeFunction());
addFunction(SeqFunction.INSTANCE);
addFunction(EvalFunction.INSTANCE);
addFunction(IsAFunction.INSTANCE);
addFunction(MetaFunction.INSTANCE);
addFunction(WithMetaFunction.INSTANCE);
addFunction(WithoutMetaFunction.INSTANCE);
}
Aggregations