org.grinvin.factories.graphs

Class AbstractGraphFactory

Implemented Interfaces:
Factory, GraphFactory, VisualFactory, VisualGraphFactory

public abstract class AbstractGraphFactory
extends AbstractFactory
implements VisualGraphFactory

Common superclass of various graph factory classes. Provides support for internationalization and some helper methods.

Field Summary

Fields inherited from class org.grinvin.factories.AbstractFactory

list, valueStrings, values

Constructor Summary

AbstractGraphFactory()
Default constructor.

Method Summary

protected static Vertex[]
createCycle(Graph graph, Embedding embedding, int nr)
Create a graph and embedding with vertices spaced equally along the circumference of the unit circle.
protected abstract void
createGraph(Graph graph, Embedding embedding)
Should be overridden to initialize graph and embedding.
URI
createGraph(GraphBundle graphBundle)
protected static Vertex[]
createPath(Graph graph, Embedding embedding, int length)
Create a graph amd embedding with vertices spaced equally along the interval -1..1.
String
getDescription()
Icon
getIcon()
String
getIconPath()
String
getId()
The id of a graph factory is usually the same as its fully qualified class name.
String
getLongName()
String
getName()
String
getSelectedIconPath()
URI
getURI()
protected void
initProperties(InternationalizedProperties iprops)
Initialize name and description for this graph from the resource bundle.

Methods inherited from class org.grinvin.factories.AbstractFactory

checkParameters, getParameterValues, getParameters, getParametersAsString, setParameterValues

Constructor Details

AbstractGraphFactory

public AbstractGraphFactory()
Default constructor.

Method Details

createCycle

protected static Vertex[] createCycle(Graph graph,
                                      Embedding embedding,
                                      int nr)
Create a graph and embedding with vertices spaced equally along the circumference of the unit circle.
Parameters:
graph - graph to which the given vertices will be assigned
embedding - embedding which will hold the coordinates
nr - number of vertices to create
Returns:
The array of vertices created

createGraph

protected abstract void createGraph(Graph graph,
                                    Embedding embedding)
            throws FactoryException
Should be overridden to initialize graph and embedding.

createGraph

public URI createGraph(GraphBundle graphBundle)
            throws FactoryParameterException,
                   FactoryException
Specified by:
createGraph in interface GraphFactory

createPath

protected static Vertex[] createPath(Graph graph,
                                     Embedding embedding,
                                     int length)
Create a graph amd embedding with vertices spaced equally along the interval -1..1.
Parameters:
graph - graph to which the given vertices will be assigned
embedding - embedding which will hold the coordinates
length - number of vertices to create
Returns:
The array of vertices created

getDescription

public String getDescription()
Specified by:
getDescription in interface GraphFactory

getIcon

public Icon getIcon()
Specified by:
getIcon in interface VisualFactory

getIconPath

public String getIconPath()
Specified by:
getIconPath in interface GraphFactory

getId

public String getId()
The id of a graph factory is usually the same as its fully qualified class name. For reasons of backwards compatibility however, ids of a class in one of the subpackages org.grinvin.factories.graphs.chemical or org.grinvin.factories.graphs.standard are given an idea as if they resided in the package org.grinvin.factories.
Specified by:
getId in interface GraphFactory

getLongName

public String getLongName()
Specified by:
getLongName in interface GraphFactory

getName

public String getName()
Specified by:
getName in interface GraphFactory

getSelectedIconPath

public String getSelectedIconPath()
Specified by:
getSelectedIconPath in interface GraphFactory

getURI

public URI getURI()
Specified by:
getURI in interface GraphFactory

initProperties

protected void initProperties(InternationalizedProperties iprops)
Initialize name and description for this graph from the resource bundle.
Parameters:
iprops - Properties object into which the results will be stored