Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pentaho.di.core
Class Condition

    java.lang.Object
      org.pentaho.di.core.Condition

All Implemented Interfaces:
  Cloneable, org.pentaho.di.core.xml.XMLInterface

    public class Condition

extends Object
implements Cloneable, org.pentaho.di.core.xml.XMLInterface

This class describes a condition in a general meaning. A condition can either be

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.

Since:
  8-06-2004
Author:
  Matt

Field Summary
`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_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 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 Summary
`Condition()`
`Condition(boolean negate, String valuename, int function, String valuename2, org.pentaho.di.core.row.ValueMetaAndData exact)`
`Condition(int operator, String valuename, int function, String valuename2, org.pentaho.di.core.row.ValueMetaAndData exact)`
`Condition(Node condnode)` Build a new condition using an XML Document Node
`Condition(Repository rep, long id_condition)` Read a condition from the repository.
`Condition(String valuename, int function, String valuename2, org.pentaho.di.core.row.ValueMetaAndData exact)`

Method Summary
`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(org.pentaho.di.core.row.RowMetaInterface rowMeta, Object[] r)`
`Condition` | `getCondition(int i)`
`int` | `getFunction()`
`static int` | `getFunction(String description)`
`String` | `getFunctionDesc()`
`long` | `getID()` Returns the database ID of this Condition if a repository was used before.
`String` | `getLeftValuename()`
`int` | `getOperator()`
`static int` | `getOperator(String description)`
`String` | `getOperatorDesc()`
`static String[]` | `getOperators()`
`static String[]` | `getRealOperators()`
`org.pentaho.di.core.row.ValueMetaAndData` | `getRightExact()`
`long` | `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()`
`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)`
`long` | `saveRep(long id_condition_parent, Repository rep)`
`long` | `saveRep(Repository rep)`
`void` | `setCondition(int i, Condition subCondition)`
`void` | `setFunction(int function)`
`void` | `setID(long id)` Set the database ID for this Condition in the repository.
`void` | `setLeftValuename(String left_valuename)`
`void` | `setNegated(boolean negate)`
`void` | `setOperator(int operator)`
`void` | `setRightExact(org.pentaho.di.core.row.ValueMetaAndData right_exact)`
`void` | `setRightExactID(long id_right_exact)` Set the database ID for the RightExact Value in the repository.
`void` | `setRightValuename(String right_valuename)`
`String` | `toString()`
`String` | `toString(int level, boolean show_negate, boolean show_operator)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### XML_TAG

    public static final String XML_TAG

See Also:
  Constant Field Values

### operators

    public static final String[] operators

### OPERATOR_NONE

    public static final int OPERATOR_NONE

See Also:
  Constant Field Values

### OPERATOR_OR

    public static final int OPERATOR_OR

See Also:
  Constant Field Values

### OPERATOR_AND

    public static final int OPERATOR_AND

See Also:
  Constant Field Values

### OPERATOR_NOT

    public static final int OPERATOR_NOT

See Also:
  Constant Field Values

### OPERATOR_OR_NOT

    public static final int OPERATOR_OR_NOT

See Also:
  Constant Field Values

### OPERATOR_AND_NOT

    public static final int OPERATOR_AND_NOT

See Also:
  Constant Field Values

### OPERATOR_XOR

    public static final int OPERATOR_XOR

See Also:
  Constant Field Values

### functions

    public static final String[] functions

### FUNC_EQUAL

    public static final int FUNC_EQUAL

See Also:
  Constant Field Values

### FUNC_NOT_EQUAL

    public static final int FUNC_NOT_EQUAL

See Also:
  Constant Field Values

### FUNC_SMALLER

    public static final int FUNC_SMALLER

See Also:
  Constant Field Values

### FUNC_SMALLER_EQUAL

    public static final int FUNC_SMALLER_EQUAL

See Also:
  Constant Field Values

### FUNC_LARGER

    public static final int FUNC_LARGER

See Also:
  Constant Field Values

### FUNC_LARGER_EQUAL

    public static final int FUNC_LARGER_EQUAL

See Also:
  Constant Field Values

### FUNC_REGEXP

    public static final int FUNC_REGEXP

See Also:
  Constant Field Values

### FUNC_NULL

    public static final int FUNC_NULL

See Also:
  Constant Field Values

### FUNC_NOT_NULL

    public static final int FUNC_NOT_NULL

See Also:
  Constant Field Values

### FUNC_IN_LIST

    public static final int FUNC_IN_LIST

See Also:
  Constant Field Values

### FUNC_CONTAINS

    public static final int FUNC_CONTAINS

See Also:
  Constant Field Values

### FUNC_STARTS_WITH

    public static final int FUNC_STARTS_WITH

See Also:
  Constant Field Values

### FUNC_ENDS_WITH

    public static final int FUNC_ENDS_WITH

See Also:
  Constant Field Values

Constructor Detail

### Condition

    public Condition()

### Condition

    public Condition(String valuename,
                     int function,
                     String valuename2,
                     org.pentaho.di.core.row.ValueMetaAndData exact)

### Condition

    public Condition(int operator,
                     String valuename,
                     int function,
                     String valuename2,
                     org.pentaho.di.core.row.ValueMetaAndData exact)

### Condition

    public Condition(boolean negate,
                     String valuename,
                     int function,
                     String valuename2,
                     org.pentaho.di.core.row.ValueMetaAndData exact)

### Condition

    public Condition(Node condnode)
              throws org.pentaho.di.core.exception.KettleXMLException

  Build a new condition using an XML Document Node

  Parameters:
    `condnode` -
  Throws:
    `org.pentaho.di.core.exception.KettleXMLException`

### Condition

    public Condition(Repository rep,
                     long id_condition)
              throws org.pentaho.di.core.exception.KettleException

  Read a condition from the repository.

  Parameters:
    `rep` - The repository to read from
    `id_condition` - The condition id
  Throws:
    `org.pentaho.di.core.exception.KettleException` - if something goes wrong.

Method Detail

### getID

    public long getID()

  Returns the database ID of this Condition if a repository was used before.

  Returns:
    the ID of the db connection.

### setID

    public void setID(long id)

  Set the database ID for this Condition in the repository.

  Parameters:
    `id` - The ID to set on this condition.

### clone

    public Object clone()

  Overrides:
    `clone` in class `Object`

### setOperator

    public void setOperator(int operator)

### getOperator

    public int getOperator()

### getOperatorDesc

    public String getOperatorDesc()

### getOperator

    public static final int getOperator(String description)

### getOperators

    public static final String[] getOperators()

### getRealOperators

    public static final String[] getRealOperators()

### setLeftValuename

    public void setLeftValuename(String left_valuename)

### getLeftValuename

    public String getLeftValuename()

### getFunction

    public int getFunction()

### setFunction

    public void setFunction(int function)

### getFunctionDesc

    public String getFunctionDesc()

### getFunction

    public static final int getFunction(String description)

### setRightValuename

    public void setRightValuename(String right_valuename)

### getRightValuename

    public String getRightValuename()

### setRightExact

    public void setRightExact(org.pentaho.di.core.row.ValueMetaAndData right_exact)

### getRightExact

    public org.pentaho.di.core.row.ValueMetaAndData getRightExact()

### getRightExactString

    public String getRightExactString()

### getRightExactID

    public long getRightExactID()

  Get the id of the RightExact Value in the repository

  Returns:
    The id of the RightExact Value in the repository

### setRightExactID

    public void setRightExactID(long id_right_exact)

  Set the database ID for the RightExact Value in the repository.

  Parameters:
    `id_right_exact` - The ID to set on this Value.

### isAtomic

    public boolean isAtomic()

### isComposite

    public boolean isComposite()

### isNegated

    public boolean isNegated()

### setNegated

    public void setNegated(boolean negate)

### negate

    public void negate()

### isEmpty

    public boolean isEmpty()

  A condition is empty when the condition is atomic and no left field is specified.

### clearFieldPositions

    public void clearFieldPositions()

  We cache the position of a value in a row. If ever we want to change the rowtype, we need to clear these cached field positions...

### evaluate

    public boolean evaluate(org.pentaho.di.core.row.RowMetaInterface rowMeta,
                            Object[] r)

### addCondition

    public void addCondition(Condition cb)

### addCondition

    public void addCondition(int idx,
                             Condition cb)

### removeCondition

    public void removeCondition(int nr)

### nrConditions

    public int nrConditions()

### getCondition

    public Condition getCondition(int i)

### setCondition

    public void setCondition(int i,
                             Condition subCondition)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### toString

    public String toString(int level,
                           boolean show_negate,
                           boolean show_operator)

### getXML

    public String getXML()
                  throws org.pentaho.di.core.exception.KettleValueException

  Specified by:
    `getXML` in interface `org.pentaho.di.core.xml.XMLInterface`
  Throws:
    `org.pentaho.di.core.exception.KettleValueException`

### getXML

    public String getXML(int level)
                  throws org.pentaho.di.core.exception.KettleValueException

  Throws:
    `org.pentaho.di.core.exception.KettleValueException`

### saveRep

    public long saveRep(Repository rep)
                 throws org.pentaho.di.core.exception.KettleException

  Throws:
    `org.pentaho.di.core.exception.KettleException`

### saveRep

    public long saveRep(long id_condition_parent,
                        Repository rep)
                 throws org.pentaho.di.core.exception.KettleException

  Throws:
    `org.pentaho.di.core.exception.KettleException`

### getUsedFields

    public String[] getUsedFields()

### getUsedFields

    public void getUsedFields(Hashtable<String,String> fields)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD