infovis.column
Class ColumnFactory

java.lang.Object
  extended by infovis.utils.BasicFactory
      extended by infovis.column.ColumnFactory

public class ColumnFactory
extends BasicFactory

Factory of Columns to create a new column based on its type name and density/sparsity.

Version:
$Revision: 1.10 $
Author:
Jean-Daniel Fekete

Nested Class Summary
static interface ColumnFactory.Creator
          Column Creator for the Factory.
static class ColumnFactory.DefaultCreator
          Default implementation of Creator.
 
Field Summary
static int COLUMN_TYPE_DEFAULT
          Constant for requesting a column by default.
static int COLUMN_TYPE_DENSE
          Constant for requesting a dense column.
static int COLUMN_TYPE_SPARSE
          Constant for requesting a sparse column.
 
Method Summary
 void add(ColumnFactory.Creator c)
          Adds a creator using its name.
 void add(String type, ColumnFactory.Creator c)
          Adds a new creator associated with a specified type name.
 void add(String type, String columnClass, String density)
          Adds a new creator associated with a specified type name and density name.
 Column create(String typeName, int type, String name)
          Create a Column given its type name and density type.
 Column create(String typeName, String name)
          Create a Column given its type name.
static Column createColumn(String typeName, int type, String name)
          Utility method to create a column from a type name using a specified name and sparsity/density specification.
static Column createColumn(String typeName, String name)
          Utility method to create a column from a type name using a specified name.
 ColumnFactory.Creator getCreator(String typeName)
          Returns a creator for the specified type name.
 ColumnFactory.Creator getCreator(String typeName, int type)
          Returns the creator for a specified type name and density type.
static ColumnFactory getInstance()
          Returns the current instance of this factory.
 String getTypeName(Column col)
          Returns a registered type name for a specified column.
 Iterator iterator()
          Returns an iterator over the type names maintained by the factory.
 boolean remove(ColumnFactory.Creator c)
          Removes a creator from this factory.
static void setInstance(ColumnFactory factory)
          Sets the current instance of this factory.
 
Methods inherited from class infovis.utils.BasicFactory
loadProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLUMN_TYPE_DENSE

public static final int COLUMN_TYPE_DENSE
Constant for requesting a dense column.

See Also:
Constant Field Values

COLUMN_TYPE_SPARSE

public static final int COLUMN_TYPE_SPARSE
Constant for requesting a sparse column.

See Also:
Constant Field Values

COLUMN_TYPE_DEFAULT

public static final int COLUMN_TYPE_DEFAULT
Constant for requesting a column by default.

See Also:
Constant Field Values
Method Detail

getInstance

public static ColumnFactory getInstance()
Returns the current instance of this factory.

Returns:
the current instance of this factory.

setInstance

public static void setInstance(ColumnFactory factory)
Sets the current instance of this factory.

Parameters:
factory - the new instance.

createColumn

public static Column createColumn(String typeName,
                                  String name)
Utility method to create a column from a type name using a specified name.

Delegates the creation to the current instance.

Parameters:
typeName - the type name
name - the column name
Returns:
a column of the specified type with the given name of null if the type is not known.

createColumn

public static Column createColumn(String typeName,
                                  int type,
                                  String name)
Utility method to create a column from a type name using a specified name and sparsity/density specification.

Delegates the creation to the current instance.

Parameters:
typeName - the type name
type - density, either COLUMN_TYPE_DENSE or COLUMN_TYPE_SPARSE.
name - the column name
Returns:
a column of the specified type with the given name of null if the type is not known.

iterator

public Iterator iterator()
Returns an iterator over the type names maintained by the factory.

Returns:
an iterator over the type names maintained by the factory.

add

public void add(String type,
                ColumnFactory.Creator c)
Adds a new creator associated with a specified type name.

Parameters:
type - the type name
c - the Creator

add

public void add(String type,
                String columnClass,
                String density)
Adds a new creator associated with a specified type name and density name.

Parameters:
type - the type name
columnClass - the class of column to create for this type name
density - a string "DENSE" or "SPARSE"

add

public void add(ColumnFactory.Creator c)
Adds a creator using its name.

Parameters:
c - the creator

remove

public boolean remove(ColumnFactory.Creator c)
Removes a creator from this factory.

Parameters:
c - the creator
Returns:
true if the creator existed and has been removed.

getCreator

public ColumnFactory.Creator getCreator(String typeName,
                                        int type)
Returns the creator for a specified type name and density type.

Parameters:
typeName - the type name
type - the density
Returns:
the creator for a specified type name and density type or null.

getCreator

public ColumnFactory.Creator getCreator(String typeName)
Returns a creator for the specified type name.

Parameters:
typeName - the type name
Returns:
a creator for the specified type name

create

public Column create(String typeName,
                     int type,
                     String name)
Create a Column given its type name and density type.

Parameters:
typeName - the type name of the column
type - the density
name - the column name
Returns:
a Column or null

create

public Column create(String typeName,
                     String name)
Create a Column given its type name.

Parameters:
typeName - the type name of the column
name - the column name
Returns:
a Column or null

getTypeName

public String getTypeName(Column col)
Returns a registered type name for a specified column.

Parameters:
col - the column
Returns:
a registered type name for the specified column.


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