Cytoscape 2.4.1 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.visual.calculators
Class AbstractCalculator

java.lang.Object
  extended by cytoscape.visual.calculators.AbstractCalculator
All Implemented Interfaces:
Calculator, Cloneable
Direct Known Subclasses:
EdgeCalculator, NodeCalculator

public abstract class AbstractCalculator
extends Object
implements Calculator

AbstractCalculator is the top of the tree for the Calculator classes. DO NOT extend this class directly! All calculators should extend one of NodeCalculator or EdgeCalculator TODO this shouldn't be public


Field Summary
static String ID
          String literal used to refer to the generic "ID" attribute.
 
Constructor Summary
AbstractCalculator(String name, ObjectMapping m, Class c)
          Create a calculator with the specified object mapping and name.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Add a ChangeListener to the calcaultor.
 void addMapping(ObjectMapping m)
          Add a mapping to the mappings contained by the calculator.
 void apply(EdgeAppearance appr, Edge e, CyNetwork net)
           
 void apply(NodeAppearance appr, Node n, CyNetwork net)
           
 Object clone()
          Clone the calculator.
 int getDupeCount()
          Get how many times this calculator has been duplicated.
 ObjectMapping getMapping(int i)
          Get the mapping at a specific index in this calculator.
 Vector getMappings()
          Get all mappings contained by this calculator.
 Properties getProperties()
          Returns a properties description of this calculator.
 Properties getProperties(String baseKey)
          Deprecated. Just use getProperties() - baseKey is already known by the calculator. This will be removed 10/2007.
abstract  String getTypeName()
           
abstract  JPanel getUI(JDialog parent, CyNetwork network)
          Get the UI for the calculator.
 void removeChangeListener(ChangeListener l)
          Remove a ChangeListener from the calcaultor.
 void setName(String newName)
          Set the name of this calculator.
 String toString()
          Get the name of this calculator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cytoscape.visual.calculators.Calculator
getPropertyLabel, getType
 

Field Detail

ID

public static final String ID
String literal used to refer to the generic "ID" attribute.

See Also:
Constant Field Values
Constructor Detail

AbstractCalculator

public AbstractCalculator(String name,
                          ObjectMapping m,
                          Class c)
Create a calculator with the specified object mapping and name. The object mapping is used to determine what classes of attribute data this calculator can map from. If the object mapping is null, no filtration on the attribute data is performed.

Parameters:
m - Object mapping for this calculator, or null
name - Name of this calculator
Method Detail

addMapping

public void addMapping(ObjectMapping m)
Add a mapping to the mappings contained by the calculator.

Parameters:
m - Mapping to add.

getMappings

public Vector getMappings()
Get all mappings contained by this calculator.

Specified by:
getMappings in interface Calculator
Returns:
Vector of all mappings contained in this calculator

getMapping

public ObjectMapping getMapping(int i)
Get the mapping at a specific index in this calculator.

Specified by:
getMapping in interface Calculator
Parameters:
i - index of mapping to retrieve
Returns:
ObjectMapping at index i

getDupeCount

public int getDupeCount()
Get how many times this calculator has been duplicated.

Returns:
Calculator duplication count

clone

public Object clone()
             throws CloneNotSupportedException
Clone the calculator. AbstractCalculator makes an independent clone of itself but DOES NOT ensure that a unique name is created. Whoever is cloning the calculator should enter the new calculator in the catalog and create an appropriate name for it if needed.

Specified by:
clone in interface Calculator
Overrides:
clone in class Object
Returns:
Clone of this calculator
Throws:
CloneNotSupportedException - if something is seriously borked.

toString

public final String toString()
Get the name of this calculator.

Specified by:
toString in interface Calculator
Overrides:
toString in class Object
Returns:
the calculator's name

setName

public void setName(String newName)
Set the name of this calculator. Should only be done by the CalculatorCatalog after checking that name will not be duplicated.

Specified by:
setName in interface Calculator
Parameters:
newName - the new name for this calculator. Must be unique.

getProperties

public Properties getProperties()
Returns a properties description of this calculator. Adds the keyword ".mapping" to the supplied base key and calls the getProperties method of MappingFactory with the ObjectMapping and the augmented base key.

Specified by:
getProperties in interface Calculator

getProperties

public Properties getProperties(String baseKey)
Deprecated. Just use getProperties() - baseKey is already known by the calculator. This will be removed 10/2007.


getUI

public abstract JPanel getUI(JDialog parent,
                             CyNetwork network)
Get the UI for the calculator.

Specified by:
getUI in interface Calculator
Parameters:
parent - Parent JDialog for the UI
network - CyNetwork object containing underlying graph data

addChangeListener

public void addChangeListener(ChangeListener l)
Add a ChangeListener to the calcaultor. When the state underlying the calculator changes, all ChangeListeners will be notified. This is used in the UI classes to ensure that the UI panes stay consistent with the data held in the mappings.

Specified by:
addChangeListener in interface Calculator
Parameters:
l - ChangeListener to add

removeChangeListener

public void removeChangeListener(ChangeListener l)
Remove a ChangeListener from the calcaultor. When the state underlying the calculator changes, all ChangeListeners will be notified. This is used in the UI classes to ensure that the UI panes stay consistent with the data held in the mappings.

Specified by:
removeChangeListener in interface Calculator
Parameters:
l - ChangeListener to add

apply

public void apply(EdgeAppearance appr,
                  Edge e,
                  CyNetwork net)
Specified by:
apply in interface Calculator

apply

public void apply(NodeAppearance appr,
                  Node n,
                  CyNetwork net)
Specified by:
apply in interface Calculator

getTypeName

public abstract String getTypeName()
Specified by:
getTypeName in interface Calculator

www.cytoscape.org