infovis
Interface Column

All Superinterfaces:
Constants, IntComparator, Metadata, RowComparator, Serializable
All Known Subinterfaces:
DynamicTable, NumberColumn, Table, Tree
All Known Implementing Classes:
AbstractColumn, BasicColumn, BasicEdgeColumn, BasicObjectColumn, BooleanColumn, CategoricalColumn, ColorColumn, ColumnColumn, ColumnId, ColumnOne, ColumnProxy, ColumnsVisualization, ColumnVisualization, ConstantColumn, DateColumn, DefaultAxisVisualization, DefaultDynamicTable, DefaultTable, DefaultTree, DefaultVisualization, DegreeColumn, DepthColumn, DoubleColumn, DoubleMatrix1DColumn, DynamicTableProxy, EventColumn, FilterColumn, FilteredTable, FloatColumn, FunctionColumn, GraphVisualization, HistogramColumn, HistogramVisualization, IcicleTreeVisualization, IdColumn, IntColumn, IntSparseColumn, LeafCountColumn, LinkVisualization, LiteralColumn, LongColumn, MatrixAxisVisualization, MatrixVisualization, MinAggregation.DenseColumn, NodeLinkGraphVisualization, NodeLinkTreeVisualization, ObjectColumn, ParallelCoordinatesVisualization, RainbowColumn, RulerTable, RulerVisualization, ScatterPlotVisualization, ShapeColumn, SortedCategoricalColumn, SparseColumn, StringColumn, StrokingVisualization, TableProxy, TimeSeriesVisualization, TreeAsGraph, TreeIntColumn, TreemapVisualization, TreeProxy, TreeVisualization

public interface Column
extends Metadata, RowComparator, Serializable

A column is an indexed collection of values of homogeneous type.

Values can also be undefined, which is useful for data sets with missing values.

A column has a name, can contain metadata and user properties, and triggers notification when its contents is changed. By convention, when the name of a column starts with a '#' character (sharp sign), the column is considered "internal", i.e not user supplied.

The interface defines columns as a collection of Strings. However, the intent is that every concrete column has to provide a textual representation for the data type it contains. The translation from the concrete data type to the string and parsing of a string representation to the concrete type is controlled by a Format.

Each column class containing objects of type TYPE implements type-specific methods with the same names (Java has no true parametric types so this has to be hand made). These methods are:

TYPE get(int index)
Returns the element at the specified position in this column.
void set(int index, TYPE element)
Replaces the element at the specified position in this column with the specified element.
void setExtend(int index, TYPE element)
Replaces the element at the specified position in this column with the specified element, growing the column if necessary.
void add(TYPE element)
Add a new element in the column.
TYPE parse(String v) throws ParseException
Parse a string and return the value for the column.
String format(TYPE v)
Returns the string representation of a value according to the current format.
static TYPEColumn getColumn(Table t, String name)
Returns a column of type TYPE from a Table or null if none exist.
TYPEColumn getColumn(Table t, int index)
Return a column with the concrete type from an Table.
TYPEColumn findColumn(Table t, String name)
Return a column with the concrete type from an Table, creating it if needed.

Version:
$Revision: 1.41 $
Author:
Jean-Daniel Fekete

Field Summary
 
Fields inherited from interface infovis.metadata.Constants
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Method Summary
 void addChangeListener(ChangeListener listener)
          Adds a listener to the list that's notified each time a change occurs.
 void addValue(String v)
          Appends the element specified in its String representation to the end of this column.
 boolean addValueOrNull(String v)
          Appends the element specified in its String representation to the end of this column or adds an undefined object if the String cannot be parsed.
 int capacity()
          Returns the current capacity of this column.
 void clear()
          Removes all of the elements from this column.
 void disableNotify()
          Disables notification until enableNotify has been called.
 void enableNotify()
          Re enable notifications, triggering eventListeners if modifications occur.
 void ensureCapacity(int minCapacity)
          Increases the capacity of this column, if necessary, to ensure that it can hold at least the number of values specified by the minimum capacity argument.
 Format getFormat()
          Returns the format.
 int getMaxIndex()
          Returns an the index of a row containing the maximum value of this column or -1 if the column has only undefined values or is empty.
 int getMinIndex()
          Returns an the index of a row containing the minimum value of this column or -1 if the column has only undefined values or is empty.
 String getName()
          Returns the column name.
 String getValueAt(int index)
          Returns the String representation of the element at the specified position in this column or null if the element is undefined.
 Class getValueClass()
          Returns the class of the elements.
 boolean hasUndefinedValue()
          Returns true if the columns contains undefined values, false otherwise.
 boolean isEmpty()
          Returns true if this column contains no elements.
 boolean isInternal()
          Returns true if the column name starts with a '#'.
 boolean isValueUndefined(int i)
          Returns true if the ith value is undefined.
 RowIterator iterator()
          Returns a RowIterator over all the valid rows of this column.
 void removeChangeListener(ChangeListener listener)
          Removes a listener from the list that's notified each time a change occurs.
 void setFormat(Format format)
          Sets the format.
 void setName(String name)
          Sets the column name.
 void setSize(int newSize)
          Sets the size of this column.
 void setValueAt(int index, String element)
          Replaces the element at the specified position in this column with the element specified in its String representation or sets if undefined if the element is null It will be read and translated using the Format.
 boolean setValueOrNullAt(int index, String v)
          Replaces the element at the specified position in this column with the element specified in its String representation or set it undefined if the String cannot be parsed.
 void setValueUndefined(int i, boolean undef)
          Sets the ith element to have an undefined value.
 int size()
          Returns the number of elements in this column.
 
Methods inherited from interface infovis.Metadata
getClientProperty, getMetadata
 
Methods inherited from interface cern.colt.function.IntComparator
compare, equals
 

Method Detail

getName

String getName()
Returns the column name.

Returns:
the column name.

setName

void setName(String name)
Sets the column name.

Parameters:
name - The name to set

isInternal

boolean isInternal()
Returns true if the column name starts with a '#'.

Returns:
true if the column name starts with a '#'.

isValueUndefined

boolean isValueUndefined(int i)
Returns true if the ith value is undefined.

Specified by:
isValueUndefined in interface RowComparator
Parameters:
i - the index
Returns:
true if the ith value is undefined.

setValueUndefined

void setValueUndefined(int i,
                       boolean undef)
Sets the ith element to have an undefined value.

Parameters:
i - the index
undef - true if the value should be undefined, false otherwise.

hasUndefinedValue

boolean hasUndefinedValue()
Returns true if the columns contains undefined values, false otherwise.

Returns:
true if the columns contains undefined values, false otherwise.

getFormat

Format getFormat()
Returns the format.

Returns:
Format

setFormat

void setFormat(Format format)
Sets the format.

Parameters:
format - The format to set

isEmpty

boolean isEmpty()
Returns true if this column contains no elements.

Returns:
true if this column contains no elements.

size

int size()
Returns the number of elements in this column.

Returns:
the number of elements in this column.

setSize

void setSize(int newSize)
Sets the size of this column.

Some column will ignore this request.

Parameters:
newSize - the new size.

clear

void clear()
Removes all of the elements from this column. The Column will be empty after this call returns. WARNING: if there is an associated format that maintains a status, such as a CategoricalFormat, it is not cleared so results may not be what you expected. The CategoricalFormat can be cleared explicitely if needed.


ensureCapacity

void ensureCapacity(int minCapacity)
Increases the capacity of this column, if necessary, to ensure that it can hold at least the number of values specified by the minimum capacity argument.

Parameters:
minCapacity - the desired minimum capacity.

capacity

int capacity()
Returns the current capacity of this column.

Returns:
the current capacity .

getValueAt

String getValueAt(int index)
Returns the String representation of the element at the specified position in this column or null if the element is undefined. The representation is generated by the current format.

Parameters:
index - index of element representation to return.
Returns:
the String representation of element at the specified position in this column or null if the element is undefined.

setValueAt

void setValueAt(int index,
                String element)
                throws ParseException
Replaces the element at the specified position in this column with the element specified in its String representation or sets if undefined if the element is null It will be read and translated using the Format. A null value sets the value to undefined. The column is extended if needed.

Parameters:
index - index of element to replace.
element - element to be stored at the specified position.
Throws:
ParseException - if the specified string cannot be parsed.

setValueOrNullAt

boolean setValueOrNullAt(int index,
                         String v)
Replaces the element at the specified position in this column with the element specified in its String representation or set it undefined if the String cannot be parsed.

Parameters:
index - index of element to set
v - element to be appended to this column.
Returns:
true if the element has been set, false if it has been set undefined.

addValue

void addValue(String v)
              throws ParseException
Appends the element specified in its String representation to the end of this column.

col.addValue(a) is equivalent to col.setValueAt(col.size(), a).

Parameters:
v - element to be appended to this column.
Throws:
ParseException - if the specified string cannot be parsed.

addValueOrNull

boolean addValueOrNull(String v)
Appends the element specified in its String representation to the end of this column or adds an undefined object if the String cannot be parsed.

col.addValueOrNull(a) is equivalent to col.setValueAtOrNull(col.size(), a).

Parameters:
v - element to be appended to this column.
Returns:
true if the value has been defined, false otherwise.

getMinIndex

int getMinIndex()
Returns an the index of a row containing the minimum value of this column or -1 if the column has only undefined values or is empty.

Returns:
the index of a row containing the minium value of this column.

getMaxIndex

int getMaxIndex()
Returns an the index of a row containing the maximum value of this column or -1 if the column has only undefined values or is empty.

Returns:
the index of a row containing the maximum value of this column.

getValueClass

Class getValueClass()
Returns the class of the elements.

Returns:
the class of the elements.

disableNotify

void disableNotify()
Disables notification until enableNotify has been called.

This method is useful if a large number of modifications is going to happen on the column and notifying each time would be too time consuming. The notification will be deferred until enableNotify is called.

Calls to disableNotify can be nested

See Also:
enableNotify()

enableNotify

void enableNotify()
Re enable notifications, triggering eventListeners if modifications occur.

See Also:
disableNotify()

addChangeListener

void addChangeListener(ChangeListener listener)
Adds a listener to the list that's notified each time a change occurs.

Parameters:
listener - the listener

removeChangeListener

void removeChangeListener(ChangeListener listener)
Removes a listener from the list that's notified each time a change occurs.

Parameters:
listener - the listener

iterator

RowIterator iterator()
Returns a RowIterator over all the valid rows of this column.

Returns:
a RowIterator over all the valid rows of this column.


Copyright 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.