com.partnersoft.io
Class DataFilterExpression

java.lang.Object
  extended by com.partnersoft.io.DataFilterExpression
All Implemented Interfaces:
Coggable, Immutable, DataFilterElement

public class DataFilterExpression
extends java.lang.Object
implements DataFilterElement, Immutable

Abstraction of an SQL where clause. Expression for defining how to filter a DataRecordSource.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Rich Stepanski

Field Summary
protected  DataFilterElement leftElem
           
protected  DataFilterOperator operator
           
protected  DataFilterElement rightElem
           
 
Constructor Summary
DataFilterExpression(Cog cog)
          Creates a new DataFilterExpression from the passed cog.
DataFilterExpression(DataFilterElement leftElem, DataFilterOperator operator, DataFilterElement rightElem)
          Creates a new DataRecordFilter.
DataFilterExpression(java.lang.String fieldName, DataFilterOperator op, java.lang.Object value)
          Creates a new DataFilterExpression.
 
Method Summary
 DataFilterElement getLeftElement()
           
 DataFilterOperator getOperator()
           
 DataFilterElement getRightElement()
           
 java.util.List<DataFilterExpression> listExpressionComponents()
          Returns list of basic DataFilterExpressions that this expression is composed of.
static DataFilterExpression parseText(java.lang.String fieldName, java.lang.String text)
          Creates a DataFilterExpression from the passed text.
 Cog toCog()
          Returns the complete internal state of this object in the form of a Cog.
 java.lang.String toString()
          Returns String representation of this expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leftElem

protected DataFilterElement leftElem

operator

protected DataFilterOperator operator

rightElem

protected DataFilterElement rightElem
Constructor Detail

DataFilterExpression

public DataFilterExpression(DataFilterElement leftElem,
                            DataFilterOperator operator,
                            DataFilterElement rightElem)
Creates a new DataRecordFilter.

Parameters:
leftElement -
operator -
rightElement -

DataFilterExpression

public DataFilterExpression(java.lang.String fieldName,
                            DataFilterOperator op,
                            java.lang.Object value)
Creates a new DataFilterExpression. Creates a complete FilterExpression.

Parameters:
fieldName -
op -
value -

DataFilterExpression

public DataFilterExpression(Cog cog)
Creates a new DataFilterExpression from the passed cog.

Parameters:
cog -
Method Detail

getLeftElement

public DataFilterElement getLeftElement()
Returns:
left Element of this Filter.

getRightElement

public DataFilterElement getRightElement()
Returns:
right Element of this Filter.

getOperator

public DataFilterOperator getOperator()
Returns:
Operator for this element.

listExpressionComponents

public java.util.List<DataFilterExpression> listExpressionComponents()
Returns list of basic DataFilterExpressions that this expression is composed of. Each element of returned list has left and right elements that are not DataFilterExpressions.

Returns:
List of DataFilterExpressions this expression is composed of.

toString

public java.lang.String toString()
Returns String representation of this expression. Creates a StringBuffer on each call, and generates result recursively.

Overrides:
toString in class java.lang.Object

parseText

public static DataFilterExpression parseText(java.lang.String fieldName,
                                             java.lang.String text)
                                      throws org.antlr.runtime.RecognitionException
Creates a DataFilterExpression from the passed text. (see com.partnersoft.io.FilterGrammer.g)

Parameters:
text -
Returns:
DataFilterExpression for passed text.
Throws:
org.antlr.runtime.RecognitionException - if text is in incorrect format.

toCog

public Cog toCog()
Description copied from interface: Coggable
Returns the complete internal state of this object in the form of a Cog.

Specified by:
toCog in interface Coggable
Returns:
Cog representing the internal state of this object