public class ExpressionVariable extends java.lang.Object implements ExpressionVariableIf
Modifier and Type | Field and Description |
---|---|
static int |
AND
Expression type.
|
static int |
EQUAL
Comparison type.
|
static int |
GREATER_EQUAL
Comparison type.
|
static int |
GREATER_THAN
Comparison type.
|
static int |
LESS_EQUAL
Comparison type.
|
static int |
LESS_THAN
Comparison type.
|
static int |
MATCH
Comparison type to match regular expression
|
static int |
N_A
Tag value not available
|
static int |
NOT_EQUAL
Comparison type.
|
static int |
OR
Expression type.
|
Constructor and Description |
---|
ExpressionVariable()
Constructor
|
ExpressionVariable(com.workingdogs.village.Record vr,
KKCriteria c)
Instantiates the attributes of the Tag object from a Record object
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
compareAge(int oper)
The value attribute is the age in seconds.
|
protected boolean |
compareBooleans(int oper)
Compare Booleans
|
protected boolean |
compareDates(int oper)
Compare dates which are stored as strings containing the millisecond value
|
protected boolean |
compareDecimals(int oper)
Compare decimals
|
protected boolean |
compareInts(int oper)
Compare integers
|
protected boolean |
compareMultiInt(int oper)
Compare Multi ints which are stored as integers separated by CustomerTag.DELIM
|
protected boolean |
compareMultiIntPlusTime(int oper)
Compare Multi ints which are stored as integer and timestamp pairs separated by
CustomerTag.DELIM.
|
protected boolean |
compareStrings(int oper)
Compare strings
|
boolean |
evaluate()
Evaluates the variable by comparing the
value attribute with the
customerValue attribute using the operator attribute. |
int |
getAndOr()
Defines whether this variable has to be ANDed or ORed with the one that precedes it.
|
int |
getCustomerTagId()
Id of the customer tag for this variable
|
java.lang.String |
getCustomerValue()
The customer value for the tag which is compared to the
value attribute when
evaluating the expression variable. |
int |
getExpressionId()
Id of the expression that this variable belongs to
|
int |
getGroupAndOr()
Defines whether this group has to be ANDed or ORed with the one that precedes it.
|
int |
getGroupOrder()
The order of the group that this expression variable belongs to.
|
int |
getId() |
int |
getOperator()
Valid operators are:
ExpressionVariable.EQUAL
ExpressionVariable.NOT_EQUAL
ExpressionVariable.GREATER_EQUAL
ExpressionVariable.GREATER_THAN
ExpressionVariable.LESS_EQUAL
ExpressionVariable.LESS_THAN
ExpressionVariable.MATCH - Used to match regular expression
Note that not all operators are valid for all tag types.
|
protected java.lang.String |
getOperatorName(int oper)
Returns the name of the operator mainly for reporting purposes.
|
int |
getOrder()
The order of this expression variable.
|
int |
getType()
The type of variable.
|
java.lang.String |
getValue()
The value of the expression variable.
|
void |
setAndOr(int andOr)
Defines whether this variable has to be ANDed or ORed with the one that precedes it.
|
void |
setCustomerTagId(int customerTagId)
Id of the customer tag for this variable
|
void |
setCustomerValue(java.lang.String customerValue)
The customer value for the tag which is compared to the
value attribute when
evaluating the expression variable. |
void |
setExpressionId(int expressionId)
Id of the expression that this variable belongs to
|
void |
setGroupAndOr(int groupAndOr)
Defines whether this group has to be ANDed or ORed with the one that precedes it.
|
void |
setGroupOrder(int groupOrder)
The order of the group that this expression variable belongs to.
|
void |
setId(int id) |
void |
setOperator(int operator)
Valid operators are:
ExpressionVariable.EQUAL
ExpressionVariable.NOT_EQUAL
ExpressionVariable.GREATER_EQUAL
ExpressionVariable.GREATER_THAN
ExpressionVariable.LESS_EQUAL
ExpressionVariable.LESS_THAN
ExpressionVariable.MATCH - Used to match regular expression
Note that not all operators are valid for all tag types.
|
void |
setOrder(int order)
The order of this expression variable.
|
void |
setType(int type)
The type of variable.
|
void |
setValue(java.lang.String value)
The value of the expression variable.
|
java.lang.String |
toString() |
public static final int EQUAL
public static final int NOT_EQUAL
public static final int GREATER_THAN
public static final int LESS_THAN
public static final int GREATER_EQUAL
public static final int LESS_EQUAL
public static final int MATCH
public static final int N_A
public static final int AND
public static final int OR
public ExpressionVariable()
public ExpressionVariable(com.workingdogs.village.Record vr, KKCriteria c) throws com.workingdogs.village.DataSetException
vr
- Record containing datac
- Criteria containing column namescom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public boolean evaluate() throws com.konakart.app.KKException
value
attribute with the
customerValue
attribute using the operator
attribute. False is
returned if any of the values are null.
Not all operators are valid for all customer tag types. The valid operators for each customer tag type are:
KKException
- an unexpected KKException exceptionprotected boolean compareStrings(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareBooleans(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareMultiInt(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareMultiIntPlusTime(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareInts(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareDates(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareAge(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected boolean compareDecimals(int oper) throws com.konakart.app.KKException
oper
- the operKKException
- an unexpected KKException exceptionprotected java.lang.String getOperatorName(int oper)
oper
- the operpublic java.lang.String toString()
toString
in class java.lang.Object
public int getId()
getId
in interface ExpressionVariableIf
public void setId(int id)
setId
in interface ExpressionVariableIf
id
- the id to setpublic int getCustomerTagId()
ExpressionVariableIf
getCustomerTagId
in interface ExpressionVariableIf
public void setCustomerTagId(int customerTagId)
ExpressionVariableIf
setCustomerTagId
in interface ExpressionVariableIf
customerTagId
- the customerTagId to setpublic int getExpressionId()
ExpressionVariableIf
getExpressionId
in interface ExpressionVariableIf
public void setExpressionId(int expressionId)
ExpressionVariableIf
setExpressionId
in interface ExpressionVariableIf
expressionId
- the expressionId to setpublic int getType()
ExpressionVariableIf
CustomerTag.STRING_TYPE
: The value is a StringCustomerTag.INT_TYPE
: The value is an integerCustomerTag.MULTI_INT_TYPE
: The value contains one or more integers
separated by a delimiter. The maxInts
attributes determines how many integers
are allowed.MULTI_INT_PLUS_TIME_TYPE
: The tag value contains one or more integer and
timestamp pairs separated by a delimiter. The maxInts
attributes determines how
many integers are allowed. The integer and timestamp are separated by a space character. The
timestamp is the number of milliseconds since 1st January 1970 (Epoch time)CustomerTag.DECIMAL_TYPE
: The value is a decimal.CustomerTag.DATE_TYPE
: The value is a date.CustomerTag.BOOLEAN_TYPE
: The value is a boolean and so must contain the
string true
or false
CustomerTag.AGE_TYPE
: The tag value is a date. When creating expressions you
can define the value to be greater or less than a length of time (in seconds) rather than
comparing it to a specific date.getType
in interface ExpressionVariableIf
public void setType(int type)
ExpressionVariableIf
CustomerTag.STRING_TYPE
: The value is a StringCustomerTag.INT_TYPE
: The value is an integerCustomerTag.MULTI_INT_TYPE
: The value contains one or more integers
separated by a delimiter. The maxInts
attributes determines how many integers
are allowed.MULTI_INT_PLUS_TIME_TYPE
: The tag value contains one or more integer and
timestamp pairs separated by a delimiter. The maxInts
attributes determines how
many integers are allowed. The integer and timestamp are separated by a space character. The
timestamp is the number of milliseconds since 1st January 1970 (Epoch time)CustomerTag.DECIMAL_TYPE
: The value is a decimal.CustomerTag.DATE_TYPE
: The value is a date.CustomerTag.BOOLEAN_TYPE
: The value is a boolean and so must contain the
string true
or false
CustomerTag.AGE_TYPE
: The tag value is a date. When creating expressions you
can define the value to be greater or less than a length of time (in seconds) rather than
comparing it to a specific date.setType
in interface ExpressionVariableIf
type
- the type to setpublic int getOperator()
ExpressionVariableIf
getOperator
in interface ExpressionVariableIf
public void setOperator(int operator)
ExpressionVariableIf
setOperator
in interface ExpressionVariableIf
operator
- the operator to setpublic java.lang.String getValue()
ExpressionVariableIf
getValue
in interface ExpressionVariableIf
public void setValue(java.lang.String value)
ExpressionVariableIf
setValue
in interface ExpressionVariableIf
value
- the value to setpublic java.lang.String getCustomerValue()
ExpressionVariableIf
value
attribute when
evaluating the expression variable.getCustomerValue
in interface ExpressionVariableIf
public void setCustomerValue(java.lang.String customerValue)
ExpressionVariableIf
value
attribute when
evaluating the expression variable.setCustomerValue
in interface ExpressionVariableIf
customerValue
- the customerValue to setpublic int getOrder()
ExpressionVariableIf
getOrder
in interface ExpressionVariableIf
public void setOrder(int order)
ExpressionVariableIf
setOrder
in interface ExpressionVariableIf
order
- the order to setpublic int getAndOr()
ExpressionVariableIf
getAndOr
in interface ExpressionVariableIf
public void setAndOr(int andOr)
ExpressionVariableIf
setAndOr
in interface ExpressionVariableIf
andOr
- the andOr to setpublic int getGroupOrder()
ExpressionVariableIf
getGroupOrder
in interface ExpressionVariableIf
public void setGroupOrder(int groupOrder)
ExpressionVariableIf
setGroupOrder
in interface ExpressionVariableIf
groupOrder
- the groupOrder to setpublic int getGroupAndOr()
ExpressionVariableIf
getGroupAndOr
in interface ExpressionVariableIf
public void setGroupAndOr(int groupAndOr)
ExpressionVariableIf
setGroupAndOr
in interface ExpressionVariableIf
groupAndOr
- the groupAndOr to setCopyright © 2018 DS Data Systems UK Ltd.