public class StringCompare 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 |
|---|
StringCompare()
Create a new instance of StringCompare.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
abs(java.lang.String valueType,
java.lang.Object value1)
Get the absolute value of the value passed in.
|
java.lang.Object |
add(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
Add the two objects together and return.
|
protected java.lang.String |
add(java.lang.String value1,
java.lang.String value2)
Add the two String values together by concatenating them.
|
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.
|
protected java.lang.String |
divide(java.lang.String value1,
java.lang.String value2)
Divide the second String value from the first by removing chars in value2
that are in value1.
|
protected boolean |
evaluate(java.lang.String value1,
java.lang.String value2,
java.lang.String operator)
Evaluate the expression and return true if true.
|
boolean |
mathCompare(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2,
java.lang.String operator)
Evaluate the expression.
|
java.lang.Object |
mathOperation(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2,
java.lang.String operator)
Evaluate the expression.
|
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 java.lang.String |
multiply(java.lang.String value1,
java.lang.String value2)
Multiply the two String values together by repeating each char in value2, every time
it occurs in value1.
|
java.lang.Object |
numEquiv(java.lang.String valueType,
long numerical)
Get the equivalent of the integer numerical value for the data type.
|
static int |
stringToNum(java.lang.String theStr)
get a numerical representation of the string - the number of characters.
|
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.
|
protected java.lang.String |
subtract(java.lang.String value1,
java.lang.String value2)
Subtract the second String value from the first by removing chars in value2
that are in value1.
|
public boolean mathCompare(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2,
java.lang.String operator)
mathCompare in interface EvaluateMathDefvalueType - the type of the value. This is the object type class name.value1 - first value. Must not be null.value2 - second value. Must not be null.operator - comparison operator - greater than (GT), less than (LT), etc.
These are all defined in the AiHeuristicConst class.public java.lang.Object mathOperation(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2,
java.lang.String operator)
mathOperation in interface EvaluateMathDefvalueType - the type of the value. This is the object type class name.value1 - first value. Must not be null.value2 - second value.operator - mathematical operator - can be add, subtract, multiply, divide.
These are all defined in the AiHeuristicConst class.protected boolean evaluate(java.lang.String value1,
java.lang.String value2,
java.lang.String operator)
value1 - first value. Must not be null.value2 - second value. Must not be null.operator - comparison operator.public java.lang.Object add(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
add in interface EvaluateMathDefvalueType - the type of the value.value1 - first value. Must not be null.value2 - second value. Must not be null.protected java.lang.String add(java.lang.String value1,
java.lang.String value2)
value1 - first value.value2 - second value.public java.lang.Object subtract(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
subtract in interface EvaluateMathDefvalueType - the type of the value.value1 - first value. Must not be null.value2 - second value. Must not be null.protected java.lang.String subtract(java.lang.String value1,
java.lang.String value2)
value1 - first value. Must not be null.value2 - second value. Must not be null.public java.lang.Object multiply(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
multiply in interface EvaluateMathDefvalue1 - first value. Must not be null.value2 - second value. Must not be null.valueType - the type of the value.protected java.lang.String multiply(java.lang.String value1,
java.lang.String value2)
value1 - first value. Must not be null.value2 - second value. Must not be null.public java.lang.Object divide(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
divide in interface EvaluateMathDefvalueType - the type of the value.value1 - first value. Must not be null.value2 - second value. Must not be null.protected java.lang.String divide(java.lang.String value1,
java.lang.String value2)
value1 - first value. Must not be null.value2 - second value. Must not be null.public java.lang.Object abs(java.lang.String valueType,
java.lang.Object value1)
valueType - the type of the value.value1 - first value.public java.lang.Object numEquiv(java.lang.String valueType,
long numerical)
valueType - the type of the value.numerical - an integer numerical value.public static int stringToNum(java.lang.String theStr)
theStr - the string to process.