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 Graphable
add(Object obj)
Adds an object to the graph.Graphable
get(Object obj)
Retrieves a component of the graph.Graph
getGraph()
Returns the graph being generated.GraphBuilder
getGraphBuilder()
Returns the underlying builder.Graphable
remove(Object obj)
Removes an object from the graph.void
setGraphBuilder(GraphBuilder builder)
Sets the underlying builder used to physically construct the graph.
-
-
-
Method Detail
-
add
public Graphable add(Object obj)
Description copied from interface:GraphGenerator
Adds an object to the graph.- Specified by:
add
in 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:GraphGenerator
Retrieves a component of the graph.- Specified by:
get
in 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:GraphGenerator
Removes an object from the graph.- Specified by:
remove
in 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:GraphGenerator
Sets the underlying builder used to physically construct the graph.- Specified by:
setGraphBuilder
in interfaceGraphGenerator
- Parameters:
builder
- The new underlying GraphBuilder.- See Also:
GraphGenerator.setGraphBuilder(GraphBuilder)
-
getGraphBuilder
public GraphBuilder getGraphBuilder()
Description copied from interface:GraphGenerator
Returns the underlying builder.- Specified by:
getGraphBuilder
in interfaceGraphGenerator
- Returns:
- The underyling builder.
- See Also:
GraphGenerator.getGraphBuilder()
-
getGraph
public Graph getGraph()
Description copied from interface:GraphGenerator
Returns the graph being generated.- Specified by:
getGraph
in interfaceGraphGenerator
- Returns:
- The generated graph.
- See Also:
GraphGenerator.getGraph()
-
-