infovis.column
Class BooleanColumn

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.BasicColumn
              extended by infovis.column.LiteralColumn
                  extended by infovis.column.BooleanColumn
All Implemented Interfaces:
IntComparator, Column, NumberColumn, Metadata, Constants, RowComparator, RowFilter, Serializable, ListSelectionModel

public class BooleanColumn
extends LiteralColumn
implements ListSelectionModel, RowFilter

Column of booleans.

Implements columns of boolean values, backed on a BitSet. A BooleanColumn also implements the ListSelectionModel so it can be used to control a selection in Swing.

Creation: BooleanColumn c = new BooleanColumn("yesorno");

Version:
$Revision: 1.42 $
Author:
Jean-Daniel Fekete
See Also:
Serialized Form
InfoVis factory arguments:
ColumnFactory "boolean" DENSE, ColumnFactory "bool" DENSE

Field Summary
 
Fields inherited from class infovis.column.AbstractColumn
MODIFIED_ALL, MODIFIED_NONE
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Fields inherited from interface infovis.metadata.Constants
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Constructor Summary
BooleanColumn(String name)
          Creates a new FloatColumn object.
BooleanColumn(String name, int reserve)
          Creates a new FloatColumn object.
 
Method Summary
 void add(boolean element)
          Adds a new element in the column.
 void addListSelectionListener(ListSelectionListener x)
           
 void addSelectionInterval(int index0, int index1)
           
 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 clearSelection()
           
 int compare(int row1, int row2)
          
 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(boolean v)
          Fills the column with the specified value.
static BooleanColumn findColumn(Table t, String name)
          Returns a column as a FloatColumn from a table, creating it if needed.
 String format(boolean v)
          Returns the string representation of a value according to the current format.
 String format(double value)
          Returns the specified value formatted according to this column's format.
 boolean get(int index)
          Returns the element at the specified position in this column.
 int getAnchorSelectionIndex()
           
static BooleanColumn getColumn(Table t, int index)
          Returns a column as a FloatColumn from a Table.
static BooleanColumn getColumn(Table t, String name)
          Returns a column as a BooleanColumn from a Table.
 double getDoubleAt(int row)
          Returns the value as a double
 int getLeadSelectionIndex()
           
 boolean getMax()
          Returns the maximum value.
 int getMaxSelectionIndex()
           
 boolean getMin()
          Returns the minimum value.
 int getMinSelectionIndex()
           
 int getSelectedCount()
          Returns the number of selected items.
 int getSelectionMode()
           
 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 getValueIsAdjusting()
           
 BitSet getValueReference()
          Returns the backing BitSet of this column (USE WITH CARE).
 void insertIndexInterval(int index, int length, boolean before)
           
 boolean isFiltered(int row)
          
 boolean isSelectedIndex(int index)
           
 boolean isSelectionEmpty()
           
 boolean parse(String v)
          Parse a string and return the value for the column.
 void removeIndexInterval(int index0, int index1)
           
 void removeListSelectionListener(ListSelectionListener x)
           
 void removeSelectionInterval(int index0, int index1)
           
 void set(int index, boolean element)
          Replaces the element at the specified position in this column with the specified element.
 void setAnchorSelectionIndex(int index)
           
 void setDoubleAt(int row, double v)
          Sets the value as a double
 void setExtend(IntArrayList list, boolean element)
          Sets a list of indexes with a specified value.
 void setExtend(int index, boolean element)
          Replaces the element at the specified position in this column with the specified element, growing the column if necessary.
 void setLeadSelectionIndex(int index)
           
 void setSelectionInterval(int index0, int index1)
           
 void setSelectionMode(int selectionMode)
           
 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 setValueIsAdjusting(boolean valueIsAdjusting)
           
 int size()
          Returns the number of elements in this column.
 
Methods inherited from class infovis.column.LiteralColumn
compareValues, getDoubleMax, getDoubleMin, getFloatAt, getIntAt, getLongAt, getNumberColumn, hasUndefinedValue, isValueUndefined, round, setFloatAt, setIntAt, setLongAt, setValueUndefined, trimUndefined
 
Methods inherited from class infovis.column.BasicColumn
addValue, addValueOrNull, firstValidRow, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, 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
addChangeListener, addValue, addValueOrNull, disableNotify, enableNotify, getFormat, getMaxIndex, getMinIndex, getName, isEmpty, isInternal, iterator, removeChangeListener, setFormat, setName, setValueOrNullAt
 
Methods inherited from interface infovis.Metadata
getClientProperty, getMetadata
 
Methods inherited from interface cern.colt.function.IntComparator
equals
 

Constructor Detail

BooleanColumn

public BooleanColumn(String name)
Creates a new FloatColumn object.

Parameters:
name - the column name.

BooleanColumn

public BooleanColumn(String name,
                     int reserve)
Creates a new FloatColumn object.

Parameters:
name - the column name.
reserve - the initial capacity.
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.

Specified by:
clear in interface Column
Overrides:
clear in class LiteralColumn
See Also:
Call clear after clearing the subclass contents since this method fires the notifications.

get

public boolean get(int index)
Returns the element at the specified position in this column.

Parameters:
index - index of element to return.
Returns:
the element at the specified position in this column.

set

public void set(int index,
                boolean 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.

getMin

public boolean getMin()
Returns the minimum value.

Returns:
the minimum value.

getMax

public boolean getMax()
Returns the maximum value.

Returns:
the maximum value.

setExtend

public void setExtend(int index,
                      boolean element)
Replaces the element at the specified position in this column with the specified element, growing the column if necessary.

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

setExtend

public void setExtend(IntArrayList list,
                      boolean element)
Sets a list of indexes with a specified value.

Parameters:
list - the indexes list
element - the boolean value

add

public final void add(boolean element)
Adds a new element in the column.

Parameters:
element - the element.

fill

public void fill(boolean v)
Fills the column with the specified value.

Parameters:
v - the value

isFiltered

public boolean isFiltered(int row)

Specified by:
isFiltered in interface RowFilter

parse

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

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

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

getColumn

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

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

getColumn

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

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

findColumn

public static BooleanColumn findColumn(Table t,
                                       String name)
Returns a column as a FloatColumn from a table, creating it if needed.

Parameters:
t - the Table
name - the column name.
Returns:
a column as a FloatColumn from a table,

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.
See Also:
Column.getValueClass()

compare

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

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

addListSelectionListener

public void addListSelectionListener(ListSelectionListener x)
Specified by:
addListSelectionListener in interface ListSelectionModel
See Also:
ListSelectionModel.addListSelectionListener(ListSelectionListener)

addSelectionInterval

public void addSelectionInterval(int index0,
                                 int index1)
Specified by:
addSelectionInterval in interface ListSelectionModel
See Also:
ListSelectionModel.addSelectionInterval(int, int)

clearSelection

public void clearSelection()
Specified by:
clearSelection in interface ListSelectionModel
See Also:
ListSelectionModel.clearSelection()

getAnchorSelectionIndex

public int getAnchorSelectionIndex()
Specified by:
getAnchorSelectionIndex in interface ListSelectionModel
See Also:
ListSelectionModel.getAnchorSelectionIndex()

getLeadSelectionIndex

public int getLeadSelectionIndex()
Specified by:
getLeadSelectionIndex in interface ListSelectionModel
See Also:
ListSelectionModel.getLeadSelectionIndex()

getMaxSelectionIndex

public int getMaxSelectionIndex()
Specified by:
getMaxSelectionIndex in interface ListSelectionModel
See Also:
ListSelectionModel.getMaxSelectionIndex()

getMinSelectionIndex

public int getMinSelectionIndex()
Specified by:
getMinSelectionIndex in interface ListSelectionModel
See Also:
ListSelectionModel.getMinSelectionIndex()

getSelectionMode

public int getSelectionMode()
Specified by:
getSelectionMode in interface ListSelectionModel
See Also:
ListSelectionModel.getSelectionMode()

getValueIsAdjusting

public boolean getValueIsAdjusting()
Specified by:
getValueIsAdjusting in interface ListSelectionModel
See Also:
ListSelectionModel.getValueIsAdjusting()

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Specified by:
insertIndexInterval in interface ListSelectionModel
See Also:
ListSelectionModel.insertIndexInterval(int, int, boolean)

isSelectedIndex

public boolean isSelectedIndex(int index)
Specified by:
isSelectedIndex in interface ListSelectionModel
See Also:
ListSelectionModel.isSelectedIndex(int)

isSelectionEmpty

public boolean isSelectionEmpty()
Specified by:
isSelectionEmpty in interface ListSelectionModel
See Also:
ListSelectionModel.isSelectionEmpty()

getSelectedCount

public int getSelectedCount()
Returns the number of selected items.

Returns:
the number of selected items.

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
Specified by:
removeIndexInterval in interface ListSelectionModel
See Also:
ListSelectionModel.removeIndexInterval(int, int)

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener x)
Specified by:
removeListSelectionListener in interface ListSelectionModel
See Also:
ListSelectionModel.removeListSelectionListener(ListSelectionListener)

removeSelectionInterval

public void removeSelectionInterval(int index0,
                                    int index1)
Specified by:
removeSelectionInterval in interface ListSelectionModel
See Also:
ListSelectionModel.removeSelectionInterval(int, int)

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int index)
Specified by:
setAnchorSelectionIndex in interface ListSelectionModel
See Also:
ListSelectionModel.setAnchorSelectionIndex(int)

setLeadSelectionIndex

public void setLeadSelectionIndex(int index)
Specified by:
setLeadSelectionIndex in interface ListSelectionModel
See Also:
ListSelectionModel.setLeadSelectionIndex(int)

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Specified by:
setSelectionInterval in interface ListSelectionModel
See Also:
ListSelectionModel.setSelectionInterval(int, int)

setSelectionMode

public void setSelectionMode(int selectionMode)
Specified by:
setSelectionMode in interface ListSelectionModel
See Also:
ListSelectionModel.setSelectionMode(int)

setValueIsAdjusting

public void setValueIsAdjusting(boolean valueIsAdjusting)
Specified by:
setValueIsAdjusting in interface ListSelectionModel
See Also:
ListSelectionModel.setValueIsAdjusting(boolean)

getDoubleAt

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

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

setDoubleAt

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

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

format

public String format(double value)
Returns the specified value formatted according to this column's format.

Specified by:
format in interface NumberColumn
Parameters:
value - the value to format
Returns:
the string formatted according to this column's format.

capacity

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

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

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.

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

getValueReference

public BitSet getValueReference()
Returns the backing BitSet of this column (USE WITH CARE).

Returns:
the backing BitSet of this column.


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