infovis.column
Class ShapeColumn

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

public class ShapeColumn
extends BasicObjectColumn

Columns of shapes and RectPool management.

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
ShapeColumn(String name)
          Constructor.
ShapeColumn(String name, int reserve)
          Constructor.
 
Method Summary
 void add(Shape s)
          Adds a shape.
 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.
 Object definedValue()
          Returns the instance of a value defined with the right type for this column.
static ShapeColumn findColumn(Table t, String name)
          Returns the ShapeColumn of the specified name in the table, creating it if needed.
 Rectangle2D.Float findRect(int index)
          Returns a rectangle at the specified index, allocating it if the index is undefined.
 void freeRect(int index)
          Frees the shape at that index, returning rectangles to the RectPool.
 Shape get(int index)
          Returns the shape at the specified index or null.
 Rectangle2D.Float getBounds()
          Returns the bounds if the shapes contained in this column.
static ShapeColumn getColumn(Table t, int index)
          Returns the ShapeColumn at the specified index in the table.
static ShapeColumn getColumn(Table t, String name)
          Returns the ShapeColumn of the specified name in the table.
 Rectangle2D.Float getRect(int index)
          Returns a rectangle at the specified index or null.
 void set(int index, Shape s)
          Sets the shape at the specified index.
 
Methods inherited from class infovis.column.BasicObjectColumn
add, capacity, compare, compare, compareValues, ensureCapacity, fill, format, getObjectAt, getOrder, getValueAt, getValueClass, getValueReference, hasUndefinedValue, indexOf, isValueUndefined, parse, remove, remove, setExtend, setObjectAt, setOrder, setSize, setValueAt, setValueUndefined, size
 
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
disableNotify, enableNotify, removeChangeListener
 

Constructor Detail

ShapeColumn

public ShapeColumn(String name)
Constructor.

Parameters:
name - the column name.

ShapeColumn

public ShapeColumn(String name,
                   int reserve)
Constructor.

Parameters:
name - the column name.
reserve - the reserved size.
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 BasicObjectColumn

get

public Shape get(int index)
Returns the shape at the specified index or null.

Parameters:
index - the index
Returns:
the shape at the specified index or null.

set

public void set(int index,
                Shape s)
Sets the shape at the specified index.

Parameters:
index - the index
s - the shape.

add

public void add(Shape s)
Adds a shape.

Parameters:
s - the shape

getRect

public Rectangle2D.Float getRect(int index)
Returns a rectangle at the specified index or null.

Assumes the shapeColumn contains a rect and not another kind of shape at this index, otherwise, a ClassCastException is thrown.

Parameters:
index - the index
Returns:
a rectangle at the specified index or null.

findRect

public Rectangle2D.Float findRect(int index)
Returns a rectangle at the specified index, allocating it if the index is undefined.

Parameters:
index - the index
Returns:
a rectangle at the specified index, allocating it if the index is undefined.

freeRect

public void freeRect(int index)
Frees the shape at that index, returning rectangles to the RectPool.

Parameters:
index - the index

getColumn

public static ShapeColumn getColumn(Table t,
                                    int index)
Returns the ShapeColumn at the specified index in the table.

Parameters:
t - the table.
index - the index
Returns:
the ShapeColumn at the specified index in the table.

getColumn

public static ShapeColumn getColumn(Table t,
                                    String name)
Returns the ShapeColumn of the specified name in the table.

Parameters:
t - the table.
name - the name
Returns:
the ShapeColumn of the specified name in the table.

findColumn

public static ShapeColumn findColumn(Table t,
                                     String name)
Returns the ShapeColumn of the specified name in the table, creating it if needed.

Parameters:
t - the table.
name - the name
Returns:
the ShapeColumn of the specified name in the table, creating it if needed.

definedValue

public Object definedValue()
Returns the instance of a value defined with the right type for this column.

Specified by:
definedValue in class BasicObjectColumn
Returns:
the instance of a value defined with the right type for this column.

getBounds

public Rectangle2D.Float getBounds()
Returns the bounds if the shapes contained in this column.

Returns:
the bounds if the shapes contained in this column.


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