org.h2gis.network.graph_creator
Class GraphFunctionParser

java.lang.Object
  extended by org.h2gis.network.graph_creator.GraphFunctionParser

public class GraphFunctionParser
extends Object

A helper class for parsing String arguments to h2network graph functions.

Author:
Adam Gouge

Nested Class Summary
static class GraphFunctionParser.Orientation
           
 
Field Summary
static String DIRECTED
           
static String EDGE_ORIENTATION_COLUMN
           
static String ORIENTATION_ERROR
           
static String POSSIBLE_ORIENTATIONS
           
static String REVERSED
           
static String SEPARATOR
           
static String UNDIRECTED
           
 
Constructor Summary
GraphFunctionParser()
           
 
Method Summary
 String getEdgeOrientation()
          Get the edge orientation column name.
 GraphFunctionParser.Orientation getGlobalOrientation()
          Get the global orientation string.
 String getWeightColumn()
          Get the weight column name.
protected static boolean isDestinationsString(String s)
          Returns true if the given string contains a comma.
static int[] parseDestinationsString(String s)
          Returns an array of destination ids from a comma-separated list of destinations.
protected  String parseEdgeOrientation(String v)
          Recovers the edge orientation from a string.
protected static GraphFunctionParser.Orientation parseGlobalOrientation(String v)
          Recovers the global orientation from a string.
static TableLocation parseInputTable(Connection connection, String inputTable)
          Convert an input table String to a TableLocation
protected  String parseWeight(String v)
          Recovers the weight column name from a string.
 void parseWeightAndOrientation(String arg1, String arg2)
          Parse the weight and orientation(s) from two strings, given in arbitrary order.
static TableLocation suffixTableLocation(TableLocation inputTable, String suffix)
          Suffix a TableLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

public static final String SEPARATOR
See Also:
Constant Field Values

DIRECTED

public static final String DIRECTED
See Also:
Constant Field Values

REVERSED

public static final String REVERSED
See Also:
Constant Field Values

UNDIRECTED

public static final String UNDIRECTED
See Also:
Constant Field Values

EDGE_ORIENTATION_COLUMN

public static final String EDGE_ORIENTATION_COLUMN
See Also:
Constant Field Values

POSSIBLE_ORIENTATIONS

public static final String POSSIBLE_ORIENTATIONS
See Also:
Constant Field Values

ORIENTATION_ERROR

public static final String ORIENTATION_ERROR
See Also:
Constant Field Values
Constructor Detail

GraphFunctionParser

public GraphFunctionParser()
Method Detail

parseWeight

protected String parseWeight(String v)
Recovers the weight column name from a string.

Parameters:
v - String
Returns:
the weight column name

parseGlobalOrientation

protected static GraphFunctionParser.Orientation parseGlobalOrientation(String v)
Recovers the global orientation from a string.

Parameters:
v - String
Returns:
The global orientation

parseEdgeOrientation

protected String parseEdgeOrientation(String v)
Recovers the edge orientation from a string.

Parameters:
v - String
Returns:
The edge orientation

parseWeightAndOrientation

public void parseWeightAndOrientation(String arg1,
                                      String arg2)
Parse the weight and orientation(s) from two strings, given in arbitrary order.

Parameters:
arg1 - Weight or orientation
arg2 - Weight or orientation

getWeightColumn

public String getWeightColumn()
Get the weight column name.

Returns:
weight column name

getGlobalOrientation

public GraphFunctionParser.Orientation getGlobalOrientation()
Get the global orientation string.

Returns:
global orientation string

getEdgeOrientation

public String getEdgeOrientation()
Get the edge orientation column name.

Returns:
edge orientation column name

isDestinationsString

protected static boolean isDestinationsString(String s)
Returns true if the given string contains a comma.

Parameters:
s - String
Returns:
true if the given string contains a comma

parseDestinationsString

public static int[] parseDestinationsString(String s)
Returns an array of destination ids from a comma-separated list of destinations.

Parameters:
s - Comma-separated list of destinations
Returns:
An array of destination ids

parseInputTable

public static TableLocation parseInputTable(Connection connection,
                                            String inputTable)
                                     throws SQLException
Convert an input table String to a TableLocation

Parameters:
connection - Connection
inputTable - Input table
Returns:
corresponding TableLocation
Throws:
SQLException

suffixTableLocation

public static TableLocation suffixTableLocation(TableLocation inputTable,
                                                String suffix)
Suffix a TableLocation

Parameters:
inputTable - Input table
suffix - Suffix
Returns:
suffixed TableLocation


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.