org.encog.ml.prg.expvalue
Class EvaluateExpr

java.lang.Object
  extended by org.encog.ml.prg.expvalue.EvaluateExpr

public final class EvaluateExpr
extends Object

Simple utility class that performs some basic operations on ExpressionValue objects.


Method Summary
static ExpressionValue add(ExpressionValue a, ExpressionValue b)
          Perform an add on two expression values.
static ExpressionValue div(ExpressionValue a, ExpressionValue b)
          Perform a division on two expression values.
static ExpressionValue equ(ExpressionValue a, ExpressionValue b)
          Perform an equal on two expressions.
static ExpressionValue mul(ExpressionValue a, ExpressionValue b)
          Perform a multiply on two expression values.
static ExpressionValue notequ(ExpressionValue a, ExpressionValue b)
          Perform a non-equal on two expressions.
static ExpressionValue pow(ExpressionValue a, ExpressionValue b)
          Perform a protected div on two expression values.
static ExpressionValue protectedDiv(ExpressionValue a, ExpressionValue b)
          Perform a protected div on two expression values.
static ExpressionValue sub(ExpressionValue a, ExpressionValue b)
          Perform a subtract on two expression values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public static ExpressionValue add(ExpressionValue a,
                                  ExpressionValue b)
Perform an add on two expression values. a+b

Parameters:
a - The first argument.
b - The second argument.
Returns:
The result of adding two numbers. Concat for strings. If one is a string, the other is converted to string. If no string, then if one is float, both are converted to int.

div

public static ExpressionValue div(ExpressionValue a,
                                  ExpressionValue b)
Perform a division on two expression values. a/b An Encog division by zero exception can occur. If one param is a float, the other is converted to a float.

Parameters:
a - The first argument, must be numeric.
b - The second argument, must be numeric.
Returns:
The result of the operation.

equ

public static ExpressionValue equ(ExpressionValue a,
                                  ExpressionValue b)
Perform an equal on two expressions. Booleans, ints and strings must exactly equal. Floating point must be equal within the default Encog tolerance.

Parameters:
a - The first parameter to check.
b - The second parameter to check.
Returns:
True/false.

mul

public static ExpressionValue mul(ExpressionValue a,
                                  ExpressionValue b)
Perform a multiply on two expression values. a*b If one param is a float, the other is converted to a float.

Parameters:
a - The first argument, must be numeric.
b - The second argument, must be numeric.
Returns:
The result of the operation.

notequ

public static ExpressionValue notequ(ExpressionValue a,
                                     ExpressionValue b)
Perform a non-equal on two expressions. Booleans, ints and strings must exactly non-equal. Floating point must be non-equal within the default Encog tolerance.

Parameters:
a - The first parameter to check.
b - The second parameter to check.
Returns:
True/false.

pow

public static ExpressionValue pow(ExpressionValue a,
                                  ExpressionValue b)
Perform a protected div on two expression values. a/b If one param is a float, the other is converted to a float.

Parameters:
a - The first argument, must be numeric.
b - The second argument, must be numeric.
Returns:
The result of the operation.

protectedDiv

public static ExpressionValue protectedDiv(ExpressionValue a,
                                           ExpressionValue b)
Perform a protected div on two expression values. a/b Division by zero results in 1.

Parameters:
a - The first argument, must be numeric.
b - The second argument, must be numeric.
Returns:
The result of the operation.

sub

public static ExpressionValue sub(ExpressionValue a,
                                  ExpressionValue b)
Perform a subtract on two expression values. a-b If one param is a float, the other is converted to a float.

Parameters:
a - The first argument, must be numeric.
b - The second argument, must be numeric.
Returns:
The result of the operation.


Copyright © 2014. All Rights Reserved.