org.grinvin.factories.graphs

Class AbstractGraphFactory

Implemented Interfaces:
Factory, GraphFactory, NamedFactory

public abstract class AbstractGraphFactory
extends AbstractNamedFactory
implements GraphFactory

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

Field Summary

Fields inherited from class org.grinvin.factories.AbstractNamedFactory

factoryProps

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, Annotation annotation)
Should be overridden to initialize graph, embedding and annotation.
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
getId()
The id of a graph factory is usually the same as its fully qualified class name.
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.AbstractNamedFactory

getDescription, getIconPath, getId, getLongName, getName, getSelectedIconPath

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,
                                    Annotation annotation)
            throws FactoryException
Should be overridden to initialize graph, embedding and annotation.

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

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
Overrides:
getId in interface AbstractNamedFactory

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