infovis.column
Class ColumnProxy

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.ColumnProxy
All Implemented Interfaces:
IntComparator, Column, Metadata, Constants, RowComparator, Serializable, EventListener, ChangeListener
Direct Known Subclasses:
BasicEdgeColumn, ColumnId, MinAggregation.DenseColumn, TableProxy

public class ColumnProxy
extends AbstractColumn
implements ChangeListener

Column forwarding all its methods to a backing column.

Version:
$Revision: 1.12 $
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
ColumnProxy(Column column)
          Creates a ColumnProxy.
 
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.
 int capacity()
          Returns the current capacity of this column.
 void clear()
          Removes all of the elements from this column.
 int compare(int row1, int row2)
          
 void dispose()
          Releases all the resources maintained by this proxy column.
 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.
 MutableAttributeSet getClientProperty()
          Returns a MutableAttributeSet associating keys to values holding user-supplied data.
 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 MutableAttributeSet associating keys to values for qualifying the data contained in the instance of this interface.
 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 row)
          Returns true if the ith value is undefined.
 RowIterator iterator()
          Returns a RowIterator over all the valid rows of this column.
 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.
 void stateChanged(ChangeEvent e)
          
 
Methods inherited from class infovis.column.AbstractColumn
addChangeListener, compareValues, computeValueMap, computeValueMap, equalObj, equals, getLastModifiedRow, toString
 
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
disableNotify, enableNotify, removeChangeListener
 

Constructor Detail

ColumnProxy

public ColumnProxy(Column column)
Creates a ColumnProxy.

Parameters:
column - the backing column.
Method Detail

dispose

public void dispose()
Releases all the resources maintained by this proxy column.


stateChanged

public void stateChanged(ChangeEvent e)

Specified by:
stateChanged in interface ChangeListener

addValue

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

Specified by:
addValue in interface Column
Parameters:
v - element to be appended to this column.
Throws:
ParseException - if the specified string cannot be parsed.

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

Specified by:
addValueOrNull in interface Column
Parameters:
v - element to be appended to this column.
Returns:
true if the value has been defined, false otherwise.

capacity

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

Specified by:
capacity in interface Column
Returns:
the current capacity .

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

compare

public int compare(int row1,
                   int row2)

Specified by:
compare in interface IntComparator

ensureCapacity

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

Specified by:
ensureCapacity in interface Column
Parameters:
minCapacity - the desired minimum capacity.

getClientProperty

public MutableAttributeSet getClientProperty()
Returns a MutableAttributeSet associating keys to values holding user-supplied data.

Specified by:
getClientProperty in interface Metadata
Returns:
an AttributeSet holding user-supplied keys/values.

getFormat

public Format getFormat()
Returns the format.

Specified by:
getFormat in interface Column
Returns:
Format

getMetadata

public MutableAttributeSet getMetadata()
Returns the MutableAttributeSet associating keys to values for qualifying the data contained in the instance of this interface.

Specified by:
getMetadata in interface Metadata
Returns:
the AttributeSet associating metadate keys to values.

getName

public String getName()
Returns the column name.

Specified by:
getName in interface Column
Returns:
the column name.

size

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

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

setSize

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

Some column will ignore this request.

Specified by:
setSize in interface Column
Parameters:
newSize - the new size.

getValueAt

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

Specified by:
getValueAt in interface Column
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.

getValueClass

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

Specified by:
getValueClass in interface Column
Returns:
the class of the elements.

isEmpty

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

Specified by:
isEmpty in interface Column
Returns:
true if this column contains no elements.

isInternal

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

Specified by:
isInternal in interface Column
Returns:
true if the column name starts with a '#'.

isValueUndefined

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

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

iterator

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

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

setFormat

public void setFormat(Format format)
Sets the format.

Specified by:
setFormat in interface Column
Parameters:
format - The format to set

setName

public void setName(String name)
Sets the column name.

Specified by:
setName in interface Column
Parameters:
name - The name to set

setValueAt

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

Specified by:
setValueAt in interface Column
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

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.

Specified by:
setValueOrNullAt in interface Column
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.

setValueUndefined

public void setValueUndefined(int i,
                              boolean undef)
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.

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.

Specified by:
getMaxIndex in interface Column
Returns:
the index of a row containing the maximum value of this column.

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.

Specified by:
getMinIndex in interface Column
Returns:
the index of a row containing the minium value of this column.

hasUndefinedValue

public boolean hasUndefinedValue()
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.


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