infovis.column
Class DoubleMatrix1DColumn

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

public class DoubleMatrix1DColumn
extends BasicColumn

Wrapper for Colt DoubleMatrix1D columns.

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

Field Summary
static String MATRIX2D_METADATA
           
 
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
DoubleMatrix1DColumn(String name, DoubleMatrix1D matrix)
           
 
Method Summary
static void addColumns(Table table, DoubleMatrix2D matrix)
           
static void addRows(Table table, DoubleMatrix2D matrix)
           
 int capacity()
          Returns the current capacity of this column.
 void clear()
          Removes all of the elements from this 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.
 void fill(double val)
           
 String format(double v)
          Returns the string representation of a value according to the current format.
 double get(int index)
           
static DoubleMatrix1DColumn getColumn(Table t, int index)
          Returns a column as a DoubleMatrix1DColumn from a Table.
static DoubleColumn getColumn(Table t, String name)
          Returns a column as a DoubleColumn from a Table.
 double getDoubleAt(int row)
           
 int getIntAt(int row)
           
 long getLongAt(int row)
           
 DoubleMatrix1D getValue()
           
 String getValueAt(int i)
          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 isValueUndefined(int i)
          Returns true if the ith value is undefined.
 double parse(String v)
          Parse a string and return the value for the column.
 double round(double value)
           
 void set(int index, double element)
          Replaces the element at the specified position in this column with the specified element.
 void setDoubleAt(int row, double v)
           
 void setSize(int newSize)
          Sets the sizeColumn of this column.
 void setValueAt(int i, String v)
          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.
 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.
 double[] toArray()
          Returns the array of double values used by the column.
 double[] toArray(double[] a)
          Returns the array of double values copied from the column.
 
Methods inherited from class infovis.column.BasicColumn
addValue, addValueOrNull, compare, firstValidRow, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, 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
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface infovis.Column
disableNotify, enableNotify, removeChangeListener
 

Field Detail

MATRIX2D_METADATA

public static final String MATRIX2D_METADATA
See Also:
Constant Field Values
Constructor Detail

DoubleMatrix1DColumn

public DoubleMatrix1DColumn(String name,
                            DoubleMatrix1D matrix)
Method Detail

addColumns

public static void addColumns(Table table,
                              DoubleMatrix2D matrix)

addRows

public static void addRows(Table table,
                           DoubleMatrix2D matrix)

getValue

public DoubleMatrix1D getValue()

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

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.

get

public double get(int index)

set

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

Parameters:
index - index of element to replace.
element - element to be stored at the specified position.

fill

public void fill(double val)

parse

public double parse(String v)
             throws ParseException
Parse a string and return the value for the column.

Parameters:
v - the string representation of the value
Returns:
the value
Throws:
ParseException - if the value cannot be parsed

format

public String format(double v)
Returns the string representation of a value according to the current format.

Parameters:
v - the value
Returns:
the string representation.

getValueAt

public String getValueAt(int i)
Description copied from interface: Column
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.

Parameters:
i - 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.
See Also:
Column.getValueAt(int)

setValueAt

public void setValueAt(int i,
                       String v)
                throws ParseException
Description copied from interface: Column
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.

Parameters:
i - index of element to replace.
v - element to be stored at the specified position.
Throws:
ParseException - if the specified string cannot be parsed.
See Also:
Column.setValueAt(int, String)

getValueClass

public Class getValueClass()
Description copied from class: BasicColumn
Returns the class of the elements.

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

isValueUndefined

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

Parameters:
i - the index
Returns:
true if the ith value is undefined.

setValueUndefined

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

Parameters:
i - the index
undef - true if the value should be undefined, false otherwise.

hasUndefinedValue

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

Returns:
true if the columns contains undefined values, false otherwise.

size

public int size()
Description copied from interface: Column
Returns the number of elements in this column.

Returns:
the number of elements in this column.

ensureCapacity

public void ensureCapacity(int minCapacity)
Description copied from interface: Column
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.

Parameters:
minCapacity - the desired minimum capacity.

capacity

public int capacity()
Description copied from interface: Column
Returns the current capacity of this column.

Returns:
the current capacity .

getColumn

public static DoubleMatrix1DColumn getColumn(Table t,
                                             int index)
Returns a column as a DoubleMatrix1DColumn from a Table.

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

getColumn

public static DoubleColumn getColumn(Table t,
                                     String name)
Returns a column as a DoubleColumn from a Table.

Parameters:
t - the Table
name - the column name.
Returns:
a DoubleColumn or null if no such column exists or the column is not a DoubleColumn.

getDoubleAt

public double getDoubleAt(int row)
See Also:
NumberColumn.getDoubleAt(int)

getIntAt

public int getIntAt(int row)
See Also:
NumberColumn.getIntAt(int)

getLongAt

public long getLongAt(int row)
See Also:
NumberColumn.getLongAt(int)

setDoubleAt

public void setDoubleAt(int row,
                        double v)
See Also:
NumberColumn.setDoubleAt(int, double)

round

public double round(double value)

toArray

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

Parameters:
a - an array of double with at least the column size or null.
Returns:
the array of doubles values copied from the column.

toArray

public double[] toArray()
Returns the array of double values used by the column.

Returns:
the array of double values used by the column.


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