|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.rules.Rule
public class Rule
A rule consists of a condition part (antecedant) and an outcome (consequent). The condition may consists of arithmetic or string comparisons combined by boolean operators. The outcome is a simple string. The grammar for a rule is as follow:
RULE := BEXPR '=>' STRING BEXPR := '(' BEXPR ')' | 'NOT' BEXPR | 'MISSING' COL | AEXPR (BINOP BEXPR)? AEXPR := COL OP COL | NUMBER OP COL | COL OP NUMBER | STRING OP COL | COL OP STRING | COL LOP STRINGLIST BOP := 'AND' | 'OR' | 'XOR' OP := '>' | '<' | '>=' | '<=' | '=' | 'LIKE' LOP := 'IN' STRING := '"' [ˆ"]* '"' NUMBER := [1-9][0-9]*(\.[0-9]+)? COL := '$' [ˆ$]+ '$' STRINGLIST := '(' STRING (',' STRING)* ')'The operators should be self-describing, if not look them up in SQL ;-)
Nested Class Summary | |
---|---|
static class |
Rule.Operators
Enumeration for all possible operators used in a rule. |
Constructor Summary | |
---|---|
Rule(String rule,
DataTableSpec spec)
Creates a new rule by parsing a rule string. |
Method Summary | |
---|---|
String |
getCondition()
Returns the rule's condition (antecedant). |
String |
getOutcome()
Returns the rule's outcome (consequent). |
static void |
main(String[] args)
Zum Testen... |
boolean |
matches(DataRow row)
Returns if this rules matches the given row. |
String |
serialize()
Returns the parsed rule in string representation. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rule(String rule, DataTableSpec spec) throws ParseException
rule
- the rule stringspec
- the spec of the table on which the rule will be applied.
ParseException
- if the rule contains a syntax errorMethod Detail |
---|
public boolean matches(DataRow row)
row
- a data row
true
if the rule matches, false
otherwisepublic String getOutcome()
public String getCondition()
public String toString()
toString
in class Object
public String serialize()
public static void main(String[] args) throws Exception
args
- Pieps
Exception
- Tröt
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |