com.google.visualization.datasource.query
Class AbstractColumn

java.lang.Object
  extended by com.google.visualization.datasource.query.AbstractColumn
Direct Known Subclasses:
AggregationColumn, ScalarFunctionColumn, SimpleColumn

public abstract class AbstractColumn
extends java.lang.Object

A column. This can be either a column by ID, or an aggregation column such as min(c1), etc.

Author:
Yonatan B.Y.

Constructor Summary
AbstractColumn()
           
 
Method Summary
abstract  boolean equals(java.lang.Object o)
           
abstract  java.util.List<AggregationColumn> getAllAggregationColumns()
          Returns a list of all aggregation columns included in this abstract column.
abstract  java.util.List<ScalarFunctionColumn> getAllScalarFunctionColumns()
          Returns a list of all scalar function columns included in this abstract column.
abstract  java.util.List<java.lang.String> getAllSimpleColumnIds()
          Returns a list of all simple (primitive) column IDs included in this AbstractColumn.
abstract  java.util.List<SimpleColumn> getAllSimpleColumns()
          Returns a list of all simple columns included in this abstract column.
 TableCell getCell(ColumnLookup lookup, TableRow row)
          Returns the cell of the column in the given row.
abstract  java.lang.String getId()
          Returns a string ID for this column.
 Value getValue(ColumnLookup lookup, TableRow row)
          Returns the value of the column in the given row.
abstract  ValueType getValueType(DataTable dataTable)
          Returns the value type of the column.
abstract  int hashCode()
           
abstract  java.lang.String toQueryString()
          Returns a string that when parsed by the query parser, should return an identical column.
abstract  void validateColumn(DataTable dataTable)
          Checks whether the column is valid.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractColumn

public AbstractColumn()
Method Detail

getId

public abstract java.lang.String getId()
Returns a string ID for this column. It can be already existing in the instance, or generated upon request, depending on the specific class implementation.

Returns:
The string ID for this column.

getAllSimpleColumnIds

public abstract java.util.List<java.lang.String> getAllSimpleColumnIds()
Returns a list of all simple (primitive) column IDs included in this AbstractColumn. This is a list to support calculated columns in the future. For example, a simple column would just return a list containing its own ID. An aggregation column would just return a list containing the ID of its aggregated column. In future, when calculated columns are introduced, a calculated column will return a list with more than one element.

Returns:
A list of all simple column IDs included in this AbstractColumn.

getValue

public Value getValue(ColumnLookup lookup,
                      TableRow row)
Returns the value of the column in the given row.

Parameters:
row - The given row.
lookup - The column lookup.
Returns:
The value of the column in the given row.

getCell

public TableCell getCell(ColumnLookup lookup,
                         TableRow row)
Returns the cell of the column in the given row.

Parameters:
row - The given row.
lookup - The column lookup.
Returns:
The cell of the column in the given row.

getAllSimpleColumns

public abstract java.util.List<SimpleColumn> getAllSimpleColumns()
Returns a list of all simple columns included in this abstract column.

Returns:
A list of all simple columns included in this abstract column.

getAllAggregationColumns

public abstract java.util.List<AggregationColumn> getAllAggregationColumns()
Returns a list of all aggregation columns included in this abstract column.

Returns:
A list of all aggregation columns included in this abstract column.

getAllScalarFunctionColumns

public abstract java.util.List<ScalarFunctionColumn> getAllScalarFunctionColumns()
Returns a list of all scalar function columns included in this abstract column.

Returns:
A list of all scalar function columns included in this abstract column.

validateColumn

public abstract void validateColumn(DataTable dataTable)
                             throws InvalidQueryException
Checks whether the column is valid. Aggregation columns and scalar function columns are valid if the aggregation or scalar function respectively matches its arguments (inner columns).

Parameters:
dataTable - The data table.
Throws:
InvalidQueryException - Thrown if the column is not valid.

getValueType

public abstract ValueType getValueType(DataTable dataTable)
Returns the value type of the column. For a simple column, returns the value type of the column itself. For an aggregation or scalar function column, returns the value type of the column after evaluating the function. For example, the value type of year(a1) is NUMBER.

Parameters:
dataTable - The data table.
Returns:
The value type of the column.

toQueryString

public abstract java.lang.String toQueryString()
Returns a string that when parsed by the query parser, should return an identical column.

Returns:
A string form of this column.

equals

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

hashCode

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


Copyright © 2009 Google. All Rights Reserved.