@Test public void evaluateConstantNaN(){ Constant constant = new Constant("NaN"); assertEquals(Double.NaN, evaluate(constant)); constant.setDataType(DataType.FLOAT); assertEquals(Float.NaN, evaluate(constant)); }
static public FieldValue evaluate(DerivedField derivedField, EvaluationContext context){ FieldName name = derivedField.getName(); if(name == null){ throw new MissingAttributeException(derivedField, PMMLAttributes.DERIVEDFIELD_NAME); } SymbolTable<FieldName> symbolTable = EvaluationContext.DERIVEDFIELD_GUARD_PROVIDER.get(); if(symbolTable != null){ symbolTable.lock(name); } try { return evaluateTypedExpressionContainer(derivedField, context); } finally { if(symbolTable != null){ symbolTable.release(name); } } }
ExpressionUtil { static public FieldValue evaluate(DerivedField derivedField, EvaluationContext context){ FieldName name = derivedField.getName(); if(name == null){ throw new MissingAttributeException(derivedField, PMMLAttributes.DERIVEDFIELD_NAME); } SymbolTable<FieldName> symbolTable = EvaluationContext.DERIVEDFIELD_GUARD_PROVIDER.get(); if(symbolTable != null){ symbolTable.lock(name); } try { return evaluateTypedExpressionContainer(derivedField, context); } finally { if(symbolTable != null){ symbolTable.release(name); } } } }
ExpressionUtil { static public FieldValue evaluate(DerivedField derivedField, EvaluationContext context){ FieldName name = derivedField.getName(); if(name == null){ throw new MissingAttributeException(derivedField, PMMLAttributes.DERIVEDFIELD_NAME); } SymbolTable<FieldName> symbolTable = EvaluationContext.DERIVEDFIELD_GUARD_PROVIDER.get(); if(symbolTable != null){ symbolTable.lock(name); } try { return evaluateTypedExpressionContainer(derivedField, context); } finally { if(symbolTable != null){ symbolTable.release(name); } } } private  ExpressionUtil(); }
ExpressionUtil { static public FieldValue evaluate(DerivedField derivedField, EvaluationContext context){ FieldName name = derivedField.getName(); if(name == null){ throw new MissingAttributeException(derivedField, PMMLAttributes.DERIVEDFIELD_NAME); } SymbolTable<FieldName> symbolTable = EvaluationContext.DERIVEDFIELD_GUARD_PROVIDER.get(); if(symbolTable != null){ symbolTable.lock(name); } try { return evaluateTypedExpressionContainer(derivedField, context); } finally { if(symbolTable != null){ symbolTable.release(name); } } } private  ExpressionUtil(); static FieldName ensureField(E hasField); static Expression ensureExpression(E hasExpression); static FieldValue evaluateExpressionContainer(E hasExpression, EvaluationContext context); static FieldValue evaluateTypedExpressionContainer(E hasTypedExpression, EvaluationContext context); static FieldValue evaluate(DerivedField derivedField, EvaluationContext context); static FieldValue evaluate(DefineFunction defineFunction, List<FieldValue> values, EvaluationContext context); static FieldValue evaluate(Expression expression, EvaluationContext context); static FieldValue evaluateConstant(Constant constant); static FieldValue evaluateFieldRef(FieldRef fieldRef, EvaluationContext context); static FieldValue evaluateNormContinuous(NormContinuous normContinuous, EvaluationContext context); static FieldValue evaluateNormDiscrete(NormDiscrete normDiscrete, EvaluationContext context); static FieldValue evaluateDiscretize(Discretize discretize, EvaluationContext context); static FieldValue evaluateMapValues(MapValues mapValues, EvaluationContext context); static FieldValue evaluateTextIndex(TextIndex textIndex, EvaluationContext context); static FieldValue evaluateApply(Apply apply, EvaluationContext context); @SuppressWarnings ( value = {"unchecked"} ) static FieldValue evaluateAggregate(Aggregate aggregate, EvaluationContext context); static FieldValue evaluateJavaExpression(JavaExpression javaExpression, EvaluationContext context); static boolean isEmptyContent(Object value); }
ExpressionUtil { static public FieldValue evaluate(DerivedField derivedField, EvaluationContext context){ FieldName name = derivedField.getName(); if(name == null){ throw new MissingAttributeException(derivedField, PMMLAttributes.DERIVEDFIELD_NAME); } SymbolTable<FieldName> symbolTable = EvaluationContext.DERIVEDFIELD_GUARD_PROVIDER.get(); if(symbolTable != null){ symbolTable.lock(name); } try { return evaluateTypedExpressionContainer(derivedField, context); } finally { if(symbolTable != null){ symbolTable.release(name); } } } private  ExpressionUtil(); static FieldName ensureField(E hasField); static Expression ensureExpression(E hasExpression); static FieldValue evaluateExpressionContainer(E hasExpression, EvaluationContext context); static FieldValue evaluateTypedExpressionContainer(E hasTypedExpression, EvaluationContext context); static FieldValue evaluate(DerivedField derivedField, EvaluationContext context); static FieldValue evaluate(DefineFunction defineFunction, List<FieldValue> values, EvaluationContext context); static FieldValue evaluate(Expression expression, EvaluationContext context); static FieldValue evaluateConstant(Constant constant); static FieldValue evaluateFieldRef(FieldRef fieldRef, EvaluationContext context); static FieldValue evaluateNormContinuous(NormContinuous normContinuous, EvaluationContext context); static FieldValue evaluateNormDiscrete(NormDiscrete normDiscrete, EvaluationContext context); static FieldValue evaluateDiscretize(Discretize discretize, EvaluationContext context); static FieldValue evaluateMapValues(MapValues mapValues, EvaluationContext context); static FieldValue evaluateTextIndex(TextIndex textIndex, EvaluationContext context); static FieldValue evaluateApply(Apply apply, EvaluationContext context); @SuppressWarnings ( value = {"unchecked"} ) static FieldValue evaluateAggregate(Aggregate aggregate, EvaluationContext context); static FieldValue evaluateJavaExpression(JavaExpression javaExpression, EvaluationContext context); static boolean isEmptyContent(Object value);  }