infovis.column
Class HistogramColumn

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.BasicColumn
              extended by infovis.column.LiteralColumn
                  extended by infovis.column.IntColumn
                      extended by infovis.column.HistogramColumn
All Implemented Interfaces:
IntComparator, Column, NumberColumn, Metadata, Constants, RowComparator, Serializable, EventListener, ChangeListener

public class HistogramColumn
extends IntColumn
implements ChangeListener

Column computing and maintaining the histogram of a specified NumberColumn.

Version:
$Revision: 1.9 $
Author:
Jean-Daniel Fekete
See Also:
Serialized Form

Field Summary
 
Fields inherited from class infovis.column.AbstractColumn
MODIFIED_ALL, MODIFIED_NONE
 
Fields inherited from interface infovis.metadata.Constants
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Constructor Summary
HistogramColumn(NumberColumn column)
          Constructor.
HistogramColumn(NumberColumn column, int bins)
          Constructor.
 
Method Summary
 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.
 void dispose()
          Releases listeners.
 int get(int index)
          Returns the element at the specified position in this column.
 NumberColumn getColumn()
          Returns the column from which this histogram is built.
 IntArrayList getValueReference()
          Returns the DoubleArrayList backing the implementation of the column (USE WITH CARE).
 RowIterator iterator()
          Returns a RowIterator over all the valid rows of this column.
 void set(int index, int element)
          Replaces the element at the specified position in this column with the specified element.
 boolean setColumn(NumberColumn col)
          Sets the column from which the histogram is built.
 void setSize(int newSize)
          Sets the sizeColumn of this column. If the new sizeColumn is greater than the current sizeColumn, new 0 items are added to the end of the column. If the new sizeColumn is less than the current sizeColumn, all components at index newSize and greater are discarded.
 int size()
          Returns the number of elements in this column.
 void sort(RowComparator comp)
          Sort the values of this column according to a comparator.
 void stableSort(RowComparator comp)
          Sort the values of this column according to a comparator using a stable sort algorithm.
 void stateChanged(ChangeEvent e)
          
 int[] toArray()
          Returns the array of integer values used by the column.
 int[] toArray(int[] a)
          Returns the array of integer values copied from the column.
 
Methods inherited from class infovis.column.IntColumn
add, addExtend, capacity, ensureCapacity, fill, findColumn, format, format, getColumn, getColumn, getDoubleAt, getFloatAt, getIntAt, getLongAt, getMax, getMin, getValueAt, getValueClass, parse, round, setDoubleAt, setExtend, setIntAt, setLongAt, setValueAt
 
Methods inherited from class infovis.column.LiteralColumn
compare, compareValues, getDoubleMax, getDoubleMin, getNumberColumn, hasUndefinedValue, isValueUndefined, setFloatAt, setValueUndefined, trimUndefined
 
Methods inherited from class infovis.column.BasicColumn
addValue, addValueOrNull, firstValidRow, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, isEmpty, isInternal, lastValidRow, setFormat, setName, setValueOrNullAt, toString
 
Methods inherited from class infovis.column.AbstractColumn
addChangeListener, computeValueMap, computeValueMap, equalObj, equals, getLastModifiedRow
 
Methods inherited from class infovis.utils.ChangeManager
disableNotify, enableNotify, getModCount, removeChangeListener
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface infovis.Column
addChangeListener, addValue, addValueOrNull, disableNotify, enableNotify, getFormat, getMaxIndex, getMinIndex, getName, isEmpty, isInternal, removeChangeListener, setFormat, setName, setValueOrNullAt
 
Methods inherited from interface infovis.Metadata
getClientProperty, getMetadata
 
Methods inherited from interface cern.colt.function.IntComparator
equals
 

Constructor Detail

HistogramColumn

public HistogramColumn(NumberColumn column,
                       int bins)
Constructor.

Parameters:
column - the column.
bins - the number of bins.

HistogramColumn

public HistogramColumn(NumberColumn column)
Constructor.

Parameters:
column - the column.
Method Detail

getColumn

public NumberColumn getColumn()
Returns the column from which this histogram is built.

Returns:
the column from which this histogram is built.

setColumn

public boolean setColumn(NumberColumn col)
Sets the column from which the histogram is built.

Parameters:
col - the column from which the histogram is built.
Returns:
true if the column has changed.

size

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

Specified by:
size in interface Column
Overrides:
size in class IntColumn
Returns:
the number of elements in this column.

clear

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

Specified by:
clear in interface Column
Overrides:
clear in class IntColumn
See Also:
Call clear after clearing the subclass contents since this method fires the notifications.

setSize

public void setSize(int newSize)
Sets the sizeColumn of this column. If the new sizeColumn is greater than the current sizeColumn, new 0 items are added to the end of the column. If the new sizeColumn is less than the current sizeColumn, all components at index newSize and greater are discarded.

Specified by:
setSize in interface Column
Overrides:
setSize in class IntColumn
Parameters:
newSize - the new sizeColumn of this column.

stateChanged

public void stateChanged(ChangeEvent e)

Specified by:
stateChanged in interface ChangeListener

get

public int get(int index)
Returns the element at the specified position in this column.

Overrides:
get in class IntColumn
Parameters:
index - index of element to return.
Returns:
the element at the specified position in this column.

iterator

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

Specified by:
iterator in interface Column
Overrides:
iterator in class BasicColumn
Returns:
a RowIterator over all the valid rows of this column.

toArray

public int[] toArray()
Returns the array of integer values used by the column. BEWARE! no copy is done for performance reasons and the array should only be read. It may become out of sync with the column if the column is resized.

Overrides:
toArray in class IntColumn
Returns:
the array of integer values used by the column.

toArray

public int[] toArray(int[] a)
Returns the array of integer values copied from the column.

Overrides:
toArray in class IntColumn
Parameters:
a - an array of int with at least the column size or null.
Returns:
the array of integer values copied from the column.

sort

public void sort(RowComparator comp)
Sort the values of this column according to a comparator.

Overrides:
sort in class IntColumn
Parameters:
comp - the comparator

stableSort

public void stableSort(RowComparator comp)
Sort the values of this column according to a comparator using a stable sort algorithm.

Overrides:
stableSort in class IntColumn
Parameters:
comp - the comparator

getValueReference

public IntArrayList getValueReference()
Returns the DoubleArrayList backing the implementation of the column (USE WITH CARE).

Overrides:
getValueReference in class IntColumn
Returns:
the DoubleArrayList backing the implementation of the column.

set

public void set(int index,
                int element)
Replaces the element at the specified position in this column with the specified element.

Overrides:
set in class IntColumn
Parameters:
index - index of element to replace.
element - element to be stored at the specified position.

dispose

public void dispose()
Releases listeners.



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