public class MathBOW extends java.lang.Object implements EvaluateMathDef
If the value Object is a MetricValue
, then this is checked for and the
value stored in it used instead.
Constructor and Description |
---|
MathBOW()
Create a new instance of MathBOW.
|
Modifier and Type | Method and Description |
---|---|
protected BagOfWords |
add(BagOfWords value1,
BagOfWords value2)
Add the two bag-of-words together.
|
java.lang.Object |
add(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
Add the two objects together and return.
|
java.lang.Object |
divide(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
Divide the first value by the second and return the result.
|
<T> boolean |
mathCompare(java.lang.String valueType,
T value1,
T value2,
java.lang.String operator)
Not defined for a BagOfWords.
|
java.lang.Object |
mathOperation(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2,
java.lang.String operator)
Evaluate the mathematical expression
value1 operator value2 . |
java.lang.Object |
multiply(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
Multiply the first value by the second and return the result.
|
protected BagOfWords |
subtract(BagOfWords value1,
BagOfWords value2)
Subtract the second value from the first and return the result.
|
java.lang.Object |
subtract(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
Subtract the second value from the first and return the result.
|
public MathBOW() throws java.lang.Exception
java.lang.Exception
- any error.public <T> boolean mathCompare(java.lang.String valueType, T value1, T value2, java.lang.String operator) throws java.lang.Exception
mathCompare
in interface EvaluateMathDef
T
- object type.valueType
- the type of the value. This is the object type classname.value1
- first value.value2
- second value.operator
- comparison operator, which evaluates 'value1 operator value2'.
Operator can be greater than (GT), less than (LT), etc. These are all defined in
the AiHeuristicConst
class.java.lang.Exception
- any error.public java.lang.Object mathOperation(java.lang.String valueType, java.lang.Object value1, java.lang.Object value2, java.lang.String operator) throws java.lang.Exception
value1 operator value2
.mathOperation
in interface EvaluateMathDef
valueType
- the type of the value, assumed to be BagOfWords.value1
- first value.value2
- second value.operator
- mathematical operator - can be add, subtract, multiply, divide.
These are all defined in the AiHeuristicConst
class.java.lang.Exception
- any error.public java.lang.Object add(java.lang.String valueType, java.lang.Object value1, java.lang.Object value2) throws java.lang.Exception
add
in interface EvaluateMathDef
valueType
- the type of the value.value1
- first value.value2
- second value.java.lang.Exception
- any error.protected BagOfWords add(BagOfWords value1, BagOfWords value2) throws java.lang.Exception
value1
- first value.value2
- second value.java.lang.Exception
- any error.public java.lang.Object subtract(java.lang.String valueType, java.lang.Object value1, java.lang.Object value2) throws java.lang.Exception
subtract
in interface EvaluateMathDef
valueType
- the type of the value.value1
- first value.value2
- second value.java.lang.Exception
- any error.protected BagOfWords subtract(BagOfWords value1, BagOfWords value2) throws java.lang.Exception
value1
- first value.value2
- second value.java.lang.Exception
- any error.public java.lang.Object multiply(java.lang.String valueType, java.lang.Object value1, java.lang.Object value2)
multiply
in interface EvaluateMathDef
valueType
- the type of the value.value1
- first value.value2
- second value.public java.lang.Object divide(java.lang.String valueType, java.lang.Object value1, java.lang.Object value2)
divide
in interface EvaluateMathDef
valueType
- the type of the value.value1
- first value.value2
- second value.