Package org.geotools.graph.build.basic
Class BasicGraphGenerator
- Object
-
- BasicGraphGenerator
-
- All Implemented Interfaces:
GraphGenerator
- Direct Known Subclasses:
BasicDirectedGraphGenerator,FeatureGraphGenerator
public class BasicGraphGenerator extends Object implements GraphGenerator
An implementation of GraphGenerator. Graphs are generated as follows:
- Objects added to the generator are 2 element object arrays.
- The elements of the array represent the objects modelled by the nodes.
- The object array itself is the object modelled by the edges.
- As each object array is added to the generator:
- A node lookup table is queried using the elements of the object array.
- If a node lookup returns null, a new node is created for its respective object.
- A new edge is created incident to the two looked up nodes.
- The underlying object of the edge is set to the be object array.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
-
-
Constructor Summary
Constructors Constructor Description BasicGraphGenerator()Constructs a new generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Graphableadd(Object obj)Adds an object to the graph.Graphableget(Object obj)Retrieves a component of the graph.GraphgetGraph()Returns the graph being generated.GraphBuildergetGraphBuilder()Returns the underlying builder.Graphableremove(Object obj)Removes an object from the graph.voidsetGraphBuilder(GraphBuilder builder)Sets the underlying builder used to physically construct the graph.
-
-
-
Method Detail
-
add
public Graphable add(Object obj)
Description copied from interface:GraphGeneratorAdds an object to the graph.- Specified by:
addin interfaceGraphGenerator- Parameters:
obj- The object to be modelled in the graph.- Returns:
- The graph component used to model the object.
- See Also:
GraphGenerator.add(Object)
-
get
public Graphable get(Object obj)
Description copied from interface:GraphGeneratorRetrieves a component of the graph.- Specified by:
getin interfaceGraphGenerator- Parameters:
obj- The object modelled by the component.- Returns:
- The graph component used to model the object.
- See Also:
GraphGenerator.get(Object)
-
remove
public Graphable remove(Object obj)
Description copied from interface:GraphGeneratorRemoves an object from the graph.- Specified by:
removein interfaceGraphGenerator- Parameters:
obj- The object modelled by the component.- Returns:
- The graph component used to model the object.
- See Also:
GraphGenerator.remove(Object)
-
setGraphBuilder
public void setGraphBuilder(GraphBuilder builder)
Description copied from interface:GraphGeneratorSets the underlying builder used to physically construct the graph.- Specified by:
setGraphBuilderin interfaceGraphGenerator- Parameters:
builder- The new underlying GraphBuilder.- See Also:
GraphGenerator.setGraphBuilder(GraphBuilder)
-
getGraphBuilder
public GraphBuilder getGraphBuilder()
Description copied from interface:GraphGeneratorReturns the underlying builder.- Specified by:
getGraphBuilderin interfaceGraphGenerator- Returns:
- The underyling builder.
- See Also:
GraphGenerator.getGraphBuilder()
-
getGraph
public Graph getGraph()
Description copied from interface:GraphGeneratorReturns the graph being generated.- Specified by:
getGraphin interfaceGraphGenerator- Returns:
- The generated graph.
- See Also:
GraphGenerator.getGraph()
-
-