infovis.column
Class SparseColumn

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.BasicColumn
              extended by infovis.column.SparseColumn
All Implemented Interfaces:
IntComparator, Column, Metadata, Constants, RowComparator, Serializable, Comparator

public abstract class SparseColumn
extends BasicColumn
implements Comparator

Base class for sparse columns, i˙e˙ columns containing few elements. A sparse column is implemented with an IntSortedMap.

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
SparseColumn(String name)
          Constructor for SparseColumn.
 
Method Summary
 int capacity()
          Returns the current capacity of this column.
 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 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.
 boolean isValueUndefined(int i)
          Returns true if the ith value is undefined.
 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.
 int size()
          Returns the number of elements in this column.
 
Methods inherited from class infovis.column.BasicColumn
addValue, addValueOrNull, compare, firstValidRow, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, getValueClass, isEmpty, isInternal, iterator, lastValidRow, setFormat, setName, setValueOrNullAt, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
compare, equals
 
Methods inherited from interface infovis.Column
disableNotify, enableNotify, getValueAt, hasUndefinedValue, removeChangeListener, setValueAt
 

Constructor Detail

SparseColumn

public SparseColumn(String name)
Constructor for SparseColumn.

Parameters:
name - the colum name.
Method Detail

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
Overrides:
clear in class BasicColumn

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.

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.

isValueUndefined

public boolean isValueUndefined(int i)
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.

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
Specified by:
setSize in class BasicColumn
Parameters:
newSize - the new sizeColumn of this column.

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.


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