infovis.column
Class LiteralColumn

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.BasicColumn
              extended by infovis.column.LiteralColumn
All Implemented Interfaces:
IntComparator, Column, NumberColumn, Metadata, Constants, RowComparator, Serializable
Direct Known Subclasses:
BooleanColumn, DoubleColumn, FloatColumn, IntColumn, LongColumn

public abstract class LiteralColumn
extends BasicColumn
implements NumberColumn

Abstract class for all columns containing literal values.

Version:
$Revision: 1.14 $
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
LiteralColumn(String name)
          Constructor for LiteralColumn.
 
Method Summary
 void clear()
          Removes all of the elements from this column.
 int compare(int row1, int row2)
          
 boolean compareValues(Column c)
          Compare the values of this column and the specified column.
abstract  double getDoubleAt(int row)
          Returns the value as a double
 double getDoubleMax()
          Returns the largset value as a double.
 double getDoubleMin()
          Returns the smallest value as a double.
 float getFloatAt(int row)
          Returns the value as a float
 int getIntAt(int row)
          Returns the value as an int
 long getLongAt(int row)
          Returns the value as a long
static NumberColumn getNumberColumn(Table t, int index)
          Returns a column as a NumberColumn from an Table.
 boolean hasUndefinedValue()
          Returns true if the columns contains undefined values, false otherwise.
 boolean isValueUndefined(int i)
          Returns true if the ith value is undefined.
 double round(double value)
          Returns the rounded value according to the semantics of this number value.
abstract  void setDoubleAt(int row, double v)
          Sets the value as a double
 void setFloatAt(int row, float v)
          Sets the value as a float
 void setIntAt(int row, int v)
          Sets the value as an int
 void setLongAt(int row, long v)
          Sets the value as a long
 void setSize(int newSize)
          Sets the sizeColumn of this column.
 void setValueUndefined(int i, boolean undef)
          Sets the ith element to have an undefined value.
 void trimUndefined()
          Removes all the undefined values at the end of the column
 
Methods inherited from class infovis.column.BasicColumn
addValue, addValueOrNull, firstValidRow, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, getValueClass, isEmpty, isInternal, iterator, 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.NumberColumn
format
 
Methods inherited from interface infovis.Column
addChangeListener, addValue, addValueOrNull, capacity, disableNotify, enableNotify, ensureCapacity, getFormat, getMaxIndex, getMinIndex, getName, getValueAt, getValueClass, isEmpty, isInternal, iterator, removeChangeListener, setFormat, setName, setValueAt, setValueOrNullAt, size
 
Methods inherited from interface infovis.Metadata
getClientProperty, getMetadata
 
Methods inherited from interface cern.colt.function.IntComparator
equals
 

Constructor Detail

LiteralColumn

public LiteralColumn(String name)
Constructor for LiteralColumn.

Parameters:
name -
Method Detail

clear

public void clear()
Description copied from class: BasicColumn
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 BasicColumn
See Also:
Call clear after clearing the subclass contents since this method fires the notifications.

compareValues

public boolean compareValues(Column c)
Description copied from class: AbstractColumn
Compare the values of this column and the specified column.

Overrides:
compareValues in class AbstractColumn
Parameters:
c - the column to compare values from
Returns:
true if the values match, false otherwise

isValueUndefined

public boolean isValueUndefined(int i)
Description copied from interface: Column
Returns true if the ith value is undefined.

Specified by:
isValueUndefined in interface Column
Specified by:
isValueUndefined in interface RowComparator
Parameters:
i - the index
Returns:
true if the ith value is undefined.
See Also:
Column.isValueUndefined(int)

setValueUndefined

public void setValueUndefined(int i,
                              boolean undef)
Description copied from interface: Column
Sets the ith element to have an undefined value.

Specified by:
setValueUndefined in interface Column
Parameters:
i - the index
undef - true if the value should be undefined, false otherwise.
See Also:
Column.setValueUndefined(int,boolean)

setSize

public void setSize(int newSize)
Description copied from class: BasicColumn
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
Specified by:
setSize in class BasicColumn
Parameters:
newSize - the new sizeColumn of this column.

trimUndefined

public void trimUndefined()
Removes all the undefined values at the end of the column


getIntAt

public int getIntAt(int row)
Returns the value as an int

Specified by:
getIntAt in interface NumberColumn
Parameters:
row - the row
Returns:
the value as an int

getFloatAt

public float getFloatAt(int row)
Returns the value as a float

Specified by:
getFloatAt in interface NumberColumn
Parameters:
row - the row
Returns:
the value as a float

getLongAt

public long getLongAt(int row)
Returns the value as a long

Specified by:
getLongAt in interface NumberColumn
Parameters:
row - the row
Returns:
the value as a long

getDoubleAt

public abstract double getDoubleAt(int row)
Returns the value as a double

Specified by:
getDoubleAt in interface NumberColumn
Parameters:
row - the row
Returns:
the value as a double

setIntAt

public void setIntAt(int row,
                     int v)
Sets the value as an int

Specified by:
setIntAt in interface NumberColumn
Parameters:
row - the row
v - the value as an int

setFloatAt

public void setFloatAt(int row,
                       float v)
Sets the value as a float

Specified by:
setFloatAt in interface NumberColumn
Parameters:
row - the row
v - the value as a float

setLongAt

public void setLongAt(int row,
                      long v)
Sets the value as a long

Specified by:
setLongAt in interface NumberColumn
Parameters:
row - the row
v - the value as a long

setDoubleAt

public abstract void setDoubleAt(int row,
                                 double v)
Sets the value as a double

Specified by:
setDoubleAt in interface NumberColumn
Parameters:
row - the row
v - the value as a double

getNumberColumn

public static NumberColumn getNumberColumn(Table t,
                                           int index)
Returns a column as a NumberColumn from an Table.

Parameters:
t - the Table
index - index in the Table
Returns:
a NumberColumn or null if no such column exists or the column is not a NumberColumn.

compare

public int compare(int row1,
                   int row2)
Description copied from class: BasicColumn

Specified by:
compare in interface IntComparator
Overrides:
compare in class BasicColumn
See Also:
IntComparator.compare(int,int)

hasUndefinedValue

public boolean hasUndefinedValue()
Description copied from interface: Column
Returns true if the columns contains undefined values, false otherwise.

Specified by:
hasUndefinedValue in interface Column
Returns:
true if the columns contains undefined values, false otherwise.

round

public double round(double value)
Description copied from interface: NumberColumn
Returns the rounded value according to the semantics of this number value.

Specified by:
round in interface NumberColumn
Parameters:
value - the value to round
Returns:
the rounded value according to the semantics of this number value.

getDoubleMin

public double getDoubleMin()
Description copied from interface: NumberColumn
Returns the smallest value as a double.

Specified by:
getDoubleMin in interface NumberColumn
Returns:
the smallest value as a double.

getDoubleMax

public double getDoubleMax()
Description copied from interface: NumberColumn
Returns the largset value as a double.

Specified by:
getDoubleMax in interface NumberColumn
Returns:
the largset value as a double.


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