public class Condition extends Object implements Cloneable, XMLInterface
1) Atomic (a=10, B='aa')
2) Composite ( NOT Condition1 AND Condition2 OR Condition3 )
If the nr of atomic conditions is 0, the condition is atomic, otherwise it's Composit.
Precedence doesn't exist. Conditions are evaluated in the order in which they are found.
A condition can be negated or not.
Modifier and Type | Field and Description |
---|---|
static int |
FUNC_CONTAINS |
static int |
FUNC_ENDS_WITH |
static int |
FUNC_EQUAL |
static int |
FUNC_IN_LIST |
static int |
FUNC_LARGER |
static int |
FUNC_LARGER_EQUAL |
static int |
FUNC_LIKE |
static int |
FUNC_NOT_EQUAL |
static int |
FUNC_NOT_NULL |
static int |
FUNC_NULL |
static int |
FUNC_REGEXP |
static int |
FUNC_SMALLER |
static int |
FUNC_SMALLER_EQUAL |
static int |
FUNC_STARTS_WITH |
static int |
FUNC_TRUE |
static String[] |
functions |
static int |
OPERATOR_AND |
static int |
OPERATOR_AND_NOT |
static int |
OPERATOR_NONE |
static int |
OPERATOR_NOT |
static int |
OPERATOR_OR |
static int |
OPERATOR_OR_NOT |
static int |
OPERATOR_XOR |
static String[] |
operators |
static String |
XML_TAG |
Constructor and Description |
---|
Condition() |
Condition(boolean negate,
String valuename,
int function,
String valuename2,
ValueMetaAndData exact) |
Condition(int operator,
String valuename,
int function,
String valuename2,
ValueMetaAndData exact) |
Condition(Node condnode)
Build a new condition using an XML Document Node
|
Condition(String xml) |
Condition(String valuename,
int function,
String valuename2,
ValueMetaAndData exact) |
Modifier and Type | Method and Description |
---|---|
void |
addCondition(Condition cb) |
void |
addCondition(int idx,
Condition cb) |
void |
clearFieldPositions()
We cache the position of a value in a row.
|
Object |
clone() |
boolean |
evaluate(RowMetaInterface rowMeta,
Object[] r)
Evaluate the condition...
|
List<Condition> |
getChildren() |
Condition |
getCondition(int i) |
int |
getFunction() |
static int |
getFunction(String description) |
String |
getFunctionDesc() |
String |
getLeftValuename() |
ObjectId |
getObjectId()
Returns the database ID of this Condition if a repository was used before.
|
int |
getOperator() |
static int |
getOperator(String description) |
String |
getOperatorDesc() |
static String[] |
getOperators() |
static String[] |
getRealOperators() |
ValueMetaAndData |
getRightExact() |
ObjectId |
getRightExactID()
Get the id of the RightExact Value in the repository
|
String |
getRightExactString() |
String |
getRightValuename() |
String[] |
getUsedFields() |
void |
getUsedFields(Hashtable<String,String> fields) |
String |
getXML()
Describes the Object implementing this interface as XML
|
String |
getXML(int level) |
boolean |
isAtomic() |
boolean |
isComposite() |
boolean |
isEmpty()
A condition is empty when the condition is atomic and no left field is specified.
|
boolean |
isNegated() |
void |
negate() |
int |
nrConditions() |
void |
removeCondition(int nr) |
void |
setCondition(int i,
Condition subCondition) |
void |
setFunction(int function) |
void |
setLeftValuename(String left_valuename) |
void |
setNegated(boolean negate) |
void |
setObjectId(ObjectId id)
Set the database ID for this Condition in the repository.
|
void |
setOperator(int operator) |
void |
setRightExact(ValueMetaAndData right_exact) |
void |
setRightExactID(ObjectId id_right_exact)
Set the database ID for the RightExact Value in the repository.
|
void |
setRightValuename(String right_valuename) |
boolean |
simplify()
This method moves up atomic conditions if there is only one sub-condition.
|
String |
toString() |
String |
toString(int level,
boolean show_negate,
boolean show_operator) |
public static final String XML_TAG
public static final String[] operators
public static final int OPERATOR_NONE
public static final int OPERATOR_OR
public static final int OPERATOR_AND
public static final int OPERATOR_NOT
public static final int OPERATOR_OR_NOT
public static final int OPERATOR_AND_NOT
public static final int OPERATOR_XOR
public static final String[] functions
public static final int FUNC_EQUAL
public static final int FUNC_NOT_EQUAL
public static final int FUNC_SMALLER
public static final int FUNC_SMALLER_EQUAL
public static final int FUNC_LARGER
public static final int FUNC_LARGER_EQUAL
public static final int FUNC_REGEXP
public static final int FUNC_NULL
public static final int FUNC_NOT_NULL
public static final int FUNC_IN_LIST
public static final int FUNC_CONTAINS
public static final int FUNC_STARTS_WITH
public static final int FUNC_ENDS_WITH
public static final int FUNC_LIKE
public static final int FUNC_TRUE
public Condition()
public Condition(String valuename, int function, String valuename2, ValueMetaAndData exact)
public Condition(int operator, String valuename, int function, String valuename2, ValueMetaAndData exact)
public Condition(boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact)
public Condition(String xml) throws KettleXMLException
KettleXMLException
public Condition(Node condnode) throws KettleXMLException
condnode
- KettleXMLException
public ObjectId getObjectId()
public void setObjectId(ObjectId id)
id
- The ID to set on this condition.public void setOperator(int operator)
public int getOperator()
public String getOperatorDesc()
public static final int getOperator(String description)
public static final String[] getOperators()
public static final String[] getRealOperators()
public void setLeftValuename(String left_valuename)
public String getLeftValuename()
public int getFunction()
public void setFunction(int function)
public String getFunctionDesc()
public static final int getFunction(String description)
public void setRightValuename(String right_valuename)
public String getRightValuename()
public void setRightExact(ValueMetaAndData right_exact)
public ValueMetaAndData getRightExact()
public String getRightExactString()
public ObjectId getRightExactID()
public void setRightExactID(ObjectId id_right_exact)
id_right_exact
- The ID to set on this Value.public boolean isAtomic()
public boolean isComposite()
public boolean isNegated()
public void setNegated(boolean negate)
public void negate()
public boolean isEmpty()
public void clearFieldPositions()
public boolean evaluate(RowMetaInterface rowMeta, Object[] r)
rowMeta
- the row metadatar
- the row datapublic void addCondition(Condition cb)
public void addCondition(int idx, Condition cb)
public void removeCondition(int nr)
public boolean simplify()
public int nrConditions()
public Condition getCondition(int i)
public void setCondition(int i, Condition subCondition)
public String toString(int level, boolean show_negate, boolean show_operator)
public String getXML() throws KettleValueException
XMLInterface
getXML
in interface XMLInterface
KettleValueException
public String getXML(int level) throws KettleValueException
KettleValueException
public String[] getUsedFields()