com.google.visualization.datasource.query
Class ComparisonFilter

java.lang.Object
  extended by com.google.visualization.datasource.query.QueryFilter
      extended by com.google.visualization.datasource.query.ComparisonFilter
Direct Known Subclasses:
ColumnColumnFilter, ColumnValueFilter

public abstract class ComparisonFilter
extends QueryFilter

A filter that decides upon a row by comparing two values. The values can be either column values or constant values, depending on the concrete class extending this one.

Author:
Yonatan B.Y.

Nested Class Summary
static class ComparisonFilter.Operator
          The set of possible comparison operators for such filters.
 
Field Summary
protected  ComparisonFilter.Operator operator
          The comparison operator for this filter.
 
Constructor Summary
protected ComparisonFilter(ComparisonFilter.Operator operator)
          Constructs a new ComparisonFilter with the given operator.
 
Method Summary
abstract  boolean equals(java.lang.Object obj)
           
 ComparisonFilter.Operator getOperator()
          Returns the operator associated with this CompoundFilter.
abstract  int hashCode()
           
protected  boolean isOperatorMatch(Value v1, Value v2)
          Matches the given two values against the operator.
 
Methods inherited from class com.google.visualization.datasource.query.QueryFilter
getAggregationColumns, getAllColumnIds, getScalarFunctionColumns, isMatch, toQueryString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operator

protected ComparisonFilter.Operator operator
The comparison operator for this filter.

Constructor Detail

ComparisonFilter

protected ComparisonFilter(ComparisonFilter.Operator operator)
Constructs a new ComparisonFilter with the given operator.

Parameters:
operator - The comparison operator for this filter.
Method Detail

isOperatorMatch

protected boolean isOperatorMatch(Value v1,
                                  Value v2)
Matches the given two values against the operator. E.g., if the operator is GT, returns true if v1 > v2. This implementation uses the compareTo() method.

Parameters:
v1 - The first value.
v2 - The second value.
Returns:
true if v1 op v2, false otherwise.

getOperator

public ComparisonFilter.Operator getOperator()
Returns the operator associated with this CompoundFilter.

Returns:
The operator associated with this CompoundFilter.

hashCode

public abstract int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2009 Google. All Rights Reserved.