|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javanetworkanalyzer.graphcreators.GraphCreator<V,E>
V - VertexE - Edgepublic class GraphCreator<V extends VId,E extends EdgeID>
Creates JGraphT graphs from a csv file produced by OrbisGIS.
| Field Summary | |
|---|---|
static int |
DIRECTED
Specifies a directed graph. |
protected static String |
DOUBLE_QUOTES
|
protected Class<? extends E> |
edgeClass
Edge class used for initializing the graph. |
protected static String |
EMPTY_STRING
|
protected static String |
END_NODE
End node column name. |
protected static int |
endNodeIndex
End node index. |
protected int |
orientation
Orientation. |
static int |
REVERSED
Specifies a directed graph with reversed edge orientation. |
protected static String |
SEPARATOR
The csv produced by OrbisGIS uses a semicolon delimiter. |
protected static String |
START_NODE
Start node column name. |
protected static int |
startNodeIndex
Start node index. |
static int |
UNDIRECTED
Specifies an undirected graph. |
protected Class<? extends V> |
vertexClass
Vertex class used for initializing the graph. |
| Constructor Summary | |
|---|---|
GraphCreator(String csvFile,
int orientation,
Class<? extends V> vertexClass,
Class<? extends E> edgeClass)
Initializes a new GraphCreator. |
|
| Method Summary | |
|---|---|
protected String |
deleteDoubleQuotes(String s)
Replaces " by the empty string. |
protected KeyedGraph<V,E> |
initializeGraph()
Initializes a graph. |
protected void |
initializeIndices(Scanner scanner)
Initialize the start node and end node indices by reading the first line of the csv file. |
protected E |
loadEdge(String[] row,
KeyedGraph<V,E> graph,
boolean reverse)
Loads an edge into the graph. |
KeyedGraph<V,E> |
loadGraph()
Returns a new graph from a csv file produced in OrbisGIS as the output.edges table given by ST_Graph. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String START_NODE
protected static final String END_NODE
protected final int orientation
protected final Class<? extends V extends VId> vertexClass
protected final Class<? extends E extends EdgeID> edgeClass
protected static int startNodeIndex
protected static int endNodeIndex
public static final int DIRECTED
public static final int REVERSED
public static final int UNDIRECTED
protected static final String SEPARATOR
protected static final String DOUBLE_QUOTES
protected static final String EMPTY_STRING
| Constructor Detail |
|---|
public GraphCreator(String csvFile,
int orientation,
Class<? extends V> vertexClass,
Class<? extends E> edgeClass)
GraphCreator.
csvFile - CSV file containing the edge information.orientation - The desired graph orientation.vertexClass - The vertex classedgeClass - The edge class| Method Detail |
|---|
public KeyedGraph<V,E> loadGraph()
throws FileNotFoundException,
NoSuchMethodException
output.edges table given by ST_Graph.
FileNotFoundException
NoSuchMethodExceptionprotected void initializeIndices(Scanner scanner)
scanner - The scanner that will read the first line of the csv file.protected String deleteDoubleQuotes(String s)
s - The String to be parsed.
String with no quotes.
protected KeyedGraph<V,E> initializeGraph()
throws NoSuchMethodException
NoSuchMethodException - If the vertex class does not have a
constructor with just an Integer parameter.
protected E loadEdge(String[] row,
KeyedGraph<V,E> graph,
boolean reverse)
row - The row from which to load the edge.graph - The graph to which the edges will be added.reverse - true iff the edge orientation should be reversed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||