com.google.visualization.datasource.query
Class ColumnValueFilter

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.ColumnValueFilter

public class ColumnValueFilter
extends ComparisonFilter

A filter that compares a column value to a constant value.

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
ColumnValueFilter(AbstractColumn column, Value value, ComparisonFilter.Operator operator)
          Constructs a new ColumnValueFilter on a given column, constant value and operator.
ColumnValueFilter(AbstractColumn column, Value value, ComparisonFilter.Operator operator, boolean isComparisonOrderReversed)
          Constructs a new ColumnValueFilter on a given column, constant value, operator, and isComparisonOrderReversed.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  java.util.List<AggregationColumn> getAggregationColumns()
          Returns a list of all aggregation columns this filter uses.
 java.util.Set<java.lang.String> getAllColumnIds()
          Returns all the columnIds this filter uses, in this case the simple column IDs of the filter's column.
 AbstractColumn getColumn()
          Returns the column ID associated with this ColumnValueFilter.
 java.util.List<ScalarFunctionColumn> getScalarFunctionColumns()
          Returns a list of all scalarFunctionColumns this filter uses, in this case the scalarFunctionColumns in the filter's column (e.g, in thefilter 'year(a)=2008' it will return year(a).
 Value getValue()
          Returns the value associated with this ColumnValueFilter.
 int hashCode()
           
 boolean isComparisonOrderReversed()
          Returns whether or not this operator's comparison order is reversed.
 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

ColumnValueFilter

public ColumnValueFilter(AbstractColumn column,
                         Value value,
                         ComparisonFilter.Operator operator,
                         boolean isComparisonOrderReversed)
Constructs a new ColumnValueFilter on a given column, constant value, operator, and isComparisonOrderReversed.

Parameters:
column - The column to compare.
value - The constant value the column value is compared to.
operator - The comparison operator to use.
isComparisonOrderReversed - Whether to reverse the comparison order of the operator.

ColumnValueFilter

public ColumnValueFilter(AbstractColumn column,
                         Value value,
                         ComparisonFilter.Operator operator)
Constructs a new ColumnValueFilter on a given column, constant value and operator.

Parameters:
column - The column to compare.
value - The constant value the column value is compared to.
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 column, and compares it against the constant value, 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 returns true when run on the value in the column, and the constant value; false otherwise.

getAllColumnIds

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

Specified by:
getAllColumnIds in class QueryFilter
Returns:
All the columnIds 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 filter's column (e.g, in thefilter 'year(a)=2008' it will return year(a).

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

getAggregationColumns

protected java.util.List<AggregationColumn> getAggregationColumns()
Returns a list of all aggregation columns this filter uses. This is kept for future use, as currently filters are not allowed to have aggregation columns. This is still used currently for validation purposes.

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

getColumn

public AbstractColumn getColumn()
Returns the column ID associated with this ColumnValueFilter.

Returns:
The column ID associated with this ColumnValueFilter.

getValue

public Value getValue()
Returns the value associated with this ColumnValueFilter.

Returns:
The value associated with this ColumnValueFilter.

isComparisonOrderReversed

public boolean isComparisonOrderReversed()
Returns whether or not this operator's comparison order is reversed. This means whether the column and the value should be reversed, i.e., instead of column op value, this will be value op column.

Returns:
Whether or not the operator's comparison order is reversed.

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.