com.google.visualization.datasource.query
Class ColumnColumnFilter

java.lang.Object
  extended by com.google.visualization.datasource.query.QueryFilter
      extended by com.google.visualization.datasource.query.ComparisonFilter
          extended by com.google.visualization.datasource.query.ColumnColumnFilter

public class ColumnColumnFilter
extends ComparisonFilter

A filter that compares two column values.

Author:
Yonatan B.Y.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.visualization.datasource.query.ComparisonFilter
ComparisonFilter.Operator
 
Field Summary
 
Fields inherited from class com.google.visualization.datasource.query.ComparisonFilter
operator
 
Constructor Summary
ColumnColumnFilter(AbstractColumn firstColumn, AbstractColumn secondColumn, ComparisonFilter.Operator operator)
          Constructs a new ColumnColumnFilter on two given columns, and an operator.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  java.util.List<AggregationColumn> getAggregationColumns()
          
 java.util.Set<java.lang.String> getAllColumnIds()
          Returns all the simple column IDs this filter uses, in this case the simple column IDs of firstColumn and secondColumn.
 AbstractColumn getFirstColumn()
          Returns the first column associated with this ColumnColumnFilter.
 java.util.List<ScalarFunctionColumn> getScalarFunctionColumns()
          Returns a list of all scalarFunctionColumns this filter uses, in this case the scalarFunctionColumns in the first and second columns (e.g, in the filter year(a) = year(date(b)) it will return year(a), year(date(b)) and date(b)).
 AbstractColumn getSecondColumn()
          Returns the second column associated with this ColumnColumnFilter.
 int hashCode()
           
 boolean isMatch(DataTable table, TableRow row)
          Implements isMatch from the QueryFilter interface.
 java.lang.String toQueryString()
          Returns a string that, when parsed by the query parser, should return an identical filter.
 
Methods inherited from class com.google.visualization.datasource.query.ComparisonFilter
getOperator, isOperatorMatch
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnColumnFilter

public ColumnColumnFilter(AbstractColumn firstColumn,
                          AbstractColumn secondColumn,
                          ComparisonFilter.Operator operator)
Constructs a new ColumnColumnFilter on two given columns, and an operator.

Parameters:
firstColumn - The first column.
secondColumn - The second column.
operator - The comparison operator to use.
Method Detail

isMatch

public boolean isMatch(DataTable table,
                       TableRow row)
Implements isMatch from the QueryFilter interface. This implementation retrieves from the row, the data in the required columns, and compares the first against the second, using the operator given in the constructor.

Specified by:
isMatch in class QueryFilter
Parameters:
table - The table containing this row.
row - The row to check.
Returns:
true if this row should be part of the result set, i.e., if the operator is true when run on the values in the two columns; false otherwise.

getAllColumnIds

public java.util.Set<java.lang.String> getAllColumnIds()
Returns all the simple column IDs this filter uses, in this case the simple column IDs of firstColumn and secondColumn.

Specified by:
getAllColumnIds in class QueryFilter
Returns:
All the column IDs this filter uses.

getScalarFunctionColumns

public java.util.List<ScalarFunctionColumn> getScalarFunctionColumns()
Returns a list of all scalarFunctionColumns this filter uses, in this case the scalarFunctionColumns in the first and second columns (e.g, in the filter year(a) = year(date(b)) it will return year(a), year(date(b)) and date(b)).

Specified by:
getScalarFunctionColumns in class QueryFilter
Returns:
A list of all scalarFunctionColumns this filter uses.

getAggregationColumns

protected java.util.List<AggregationColumn> getAggregationColumns()

Specified by:
getAggregationColumns in class QueryFilter
Returns:
A list of all aggregation columns this filter uses.

getFirstColumn

public AbstractColumn getFirstColumn()
Returns the first column associated with this ColumnColumnFilter.

Returns:
The first column associated with this ColumnColumnFilter.

getSecondColumn

public AbstractColumn getSecondColumn()
Returns the second column associated with this ColumnColumnFilter.

Returns:
The second column associated with this ColumnColumnFilter.

toQueryString

public java.lang.String toQueryString()
Returns a string that, when parsed by the query parser, should return an identical filter. The string returned does not contain the WHERE keyword.

Specified by:
toQueryString in class QueryFilter
Returns:
A string form of this filter.

hashCode

public int hashCode()
Specified by:
hashCode in class ComparisonFilter

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in class ComparisonFilter


Copyright © 2009 Google. All Rights Reserved.