infovis.column
Class BasicColumn

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.BasicColumn
All Implemented Interfaces:
IntComparator, Column, Metadata, Constants, RowComparator, Serializable
Direct Known Subclasses:
BasicObjectColumn, DoubleMatrix1DColumn, IntSparseColumn, LiteralColumn, SparseColumn

public abstract class BasicColumn
extends AbstractColumn

BasicColumn implements the management of name, Metadata, clientProperty and Format. It also implements generically the copyFrom method.

Version:
$Revision: 1.18 $
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
BasicColumn(String name)
          Constructor for Column.
 
Method Summary
 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.
 void clear()
          Removes all of the elements from this column.
 int compare(int row1, int row2)
          
 int firstValidRow()
          Returns the index of the first row which has a defined value or Integer.MAX_VALUE if there is none.
 MutableAttributeSet getClientProperty()
          Returns the clientPropery.
 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.
 MutableAttributeSet getMetadata()
          Returns the metadata.
 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 name.
abstract  Class getValueClass()
          Returns the class of the elements.
 boolean isEmpty()
          Returns true if this column contains no elements.
 boolean isInternal()
          Returns true if the column name starts with a '#'.
 RowIterator iterator()
          Returns a RowIterator over all the valid rows of this column.
 int lastValidRow()
          Returns the index of the last row which has a defined value or -1 if there is none.
 void setFormat(Format format)
          Sets the format.
 void setName(String name)
          Sets the name.
abstract  void setSize(int newSize)
          Sets the sizeColumn of this column.
 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.
 String toString()
          
 
Methods inherited from class infovis.column.AbstractColumn
addChangeListener, compareValues, 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
capacity, disableNotify, enableNotify, ensureCapacity, getValueAt, hasUndefinedValue, isValueUndefined, removeChangeListener, setValueAt, setValueUndefined, size
 

Constructor Detail

BasicColumn

public BasicColumn(String name)
Constructor for Column.

Parameters:
name - the column name
Method Detail

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.


getName

public String getName()
Returns the name.

Returns:
String

setName

public void setName(String name)
Sets the name.

Parameters:
name - The name to set

isInternal

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

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

getClientProperty

public MutableAttributeSet getClientProperty()
Returns the clientPropery.

Returns:
AttributeSet

getMetadata

public MutableAttributeSet getMetadata()
Returns the metadata.

Returns:
Map

getFormat

public Format getFormat()
Returns the format.

Returns:
Format

setFormat

public void setFormat(Format format)
Sets the format.

Parameters:
format - The format to set

isEmpty

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

Returns:
true if this column contains no elements.

setSize

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

Parameters:
newSize - the new sizeColumn of this column.

addValue

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

setValueOrNullAt

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

addValueOrNull

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

getValueClass

public abstract Class getValueClass()
Returns the class of the elements.

Returns:
the class of the elements.

firstValidRow

public int firstValidRow()
Returns the index of the first row which has a defined value or Integer.MAX_VALUE if there is none.

Returns:
the index of the first row which has a defined value or Integer.MAX_VALUE if there is none.

lastValidRow

public int lastValidRow()
Returns the index of the last row which has a defined value or -1 if there is none.

Returns:
the index of the last row which has a defined value or -1 if there is none.

compare

public int compare(int row1,
                   int row2)


iterator

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

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

toString

public String toString()

Overrides:
toString in class AbstractColumn

getMinIndex

public 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

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


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