Package oracle.spatial.network
Class NetworkManager
- java.lang.Object
-
- oracle.spatial.network.NetworkManager
-
public class NetworkManager extends java.lang.ObjectThis class defines methods for the network data I/O and network analysis.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddNetworkToCache(java.lang.String networkName, Network network)Adds a network in the network cahcestatic Path[]allPaths(Network network, int startNodeID, int goalNodeID, int depthLimit, double costLimit, int noOfSolutions)Returns all paths between the start node and the goal node.static Path[]allPaths(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, int noOfSolutions)Returns all paths between the start node and the goal node.static Path[]allPaths(Path complexPath, int depthLimit, double costLimit, int noOfSolutions)Returns all paths between the start node and the goal node of the complex path.static voidclearNetworkCache()Clears the network cachestatic NetworkconvertNetworkBetweenWorkspaces(java.sql.Connection conn, Network sourceNetwork, java.lang.String sourceWorkspace, java.lang.String sourceSavepoint, java.lang.String targetWorkspace, java.lang.String targetSavepoint)Converts the source network into the network in the target workspace and savepoint based on their diffs in a workspace(version-enabled) environment.static voidcreateNetworkHiearchy(Network network, int numHierarchy, int[] ndNumLevel)Creates a network hiearchy with the given number of levels.static voidcreateRefConstraints(java.sql.Connection conn, java.lang.String network)Creates the referential constraints on the link and the path tables.static voidderegisterJavaObject(java.sql.Connection conn, java.lang.String name)Deregister the given Java object from user_sdo_network_java_objectsstatic voidderegisterNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName)Deregister the given constraint from user_sdo_network_constraintsstatic voiddisableRefConstraints(java.sql.Connection conn, java.lang.String network)Disables the referential constraints on the link and the path tables.static voiddropNetwork(java.sql.Connection conn, java.lang.String network)Drops the network from the database.static voiddropRefConstraints(java.sql.Connection conn, java.lang.String network)Drops the referential constraints on the link and the path tables.static voidenableRefConstraints(java.sql.Connection conn, java.lang.String network)Enables the referential constraints on the link and the path tables.static intfindConnectedComponents(Network network)Returns the number of connected components in the network.static java.util.VectorfindConnectedComponentVector(Network network)Returns connected components of the network in a Vector.static Link[]findExternalLinks(Node[] nodeArray1, Node[] nodeArray2)Returns external links between the two arrays of nodes.static Link[]findInternalLinks(Node[] nodeArray)Returns the internal links of the node array.static intfindMaxNodeDegree(Network network, int degreeType)Finds the maximum node degree of the networkstatic MBRfindMBR(Node[] nodeArray, double expandFactor)Returns the MBR of the node array and expanded it by the specified factor.static intfindMinNodeDegree(Network network, int degreeType)Finds the minimum node degree of the networkstatic Node[]findNodesWithinDegreeBounds(Network network, int degreeType, int minDegree, int maxDegree)Finds nodes with degree within the given degree bounds.static Node[]findReachableNodes(Network network, int sourceNodeID)Returns all nodes that can be reached from the source node.static Node[]findReachableNodes(Network network, int sourceNodeID, MBR mbr)Returns all nodes that can be reached from the source node.static Node[]findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit)Returns all nodes that can be reached from the source node.static Node[]findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit, int maxNoOfNodes)Returns all nodes that can be reached from the source node.static Node[]findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit, NetworkConstraint constraint, int maxNoOfNodes)Returns all nodes that can be reached from the source node.static Node[]findReachableNodes(Network network, int sourceNodeID, NetworkConstraint constraint)Returns all nodes that can be reached from the source node.static Node[]findReachingNodes(Network network, int targetNodeID)Returns all nodes that can reach the target node.static Node[]findReachingNodes(Network network, int targetNodeID, MBR mbr)Returns all nodes that can reach the target node.static Node[]findReachingNodes(Network network, int targetNodeID, MBR mbr, int depthLimit)Returns all nodes that can reach the target node.static Node[]findReachingNodes(Network network, int targetNodeID, MBR mbr, int depthLimit, NetworkConstraint constraint, int maxNoOfNodes)Returns all nodes that can reach the target node.static Node[]findReachingNodes(Network network, int targetNodeID, NetworkConstraint constraint)Returns all nodes that can reach the target node.static longgetMaxFlow(Network network, int sourceNodeID, int sinkNodeID, java.util.Vector linkFlowVec)Retunrs the max flow between the source node and the sink nodestatic java.util.HashMapgetNetworkCacheMap()Returns the network cache as a HashMap with network name (type: String) as keys and networks (type: Network) as valuesstatic NetworkgetNetworkFromCache(java.lang.String networkName)Gets the network from the network cache if the specified network is not in the cache, null will be returned To add a network in the cache, use Networkmanager.putNetworkToCache(networkname, network)static intgetNetworkIDFromName(java.sql.Connection conn, java.lang.String networkName)Returns the network ID from a given network namestatic java.util.HashMapgetNetworkIDs(java.sql.Connection conn)Retunrs network names and IDs from the database.static java.lang.StringgetNetworkNameFromID(java.sql.Connection conn, int networkID)Returns the network name from a given network IDstatic java.util.HashMapgetNetworkNames(java.sql.Connection conn)Retunrs network names and IDs from the database.JGeometrygetPathGeomFromDB(java.sql.Connection conn, Network network, Path path, java.lang.String linkTableName, java.lang.String linkGeomColumnName, java.lang.String nodeTableName, java.lang.String nodeGeomColumnName, double tolerance)Gets/Computes the path geometry based on the geometries of path links and nodes in the databasestatic java.lang.StringgetVersion()Returns the version of the SDO networkAdapter.static voidinsertGeomMetadata(java.sql.Connection conn, java.lang.String tableName, java.lang.String geomColumnName, int srid, SDODimArray dimArray)Inserts the geometry metadata to the database.static booleanisNetworkInCache(java.lang.String networkName)Checks if a given network is in the cachestatic booleanisNetworkPartitioned(java.sql.Connection conn, java.lang.String networkName)Returns the partition ID of the given nodestatic booleanisReachable(Network network, int sourceNodeID, int targetNodeID)Checks if the source node can reach the target node.static booleanisReachable(Network network, int sourceNodeID, int targetNodeID, MBR mbr, int depthLimit)Checks if the source node can reach the target node.static booleanisReachable(Network network, int sourceNodeID, int targetNodeID, NetworkConstraint constraint)Checks if the source node can reach the target node.static voidmakeLogical(Network network)Convert a spatial network to a logical network Note this only updates the network metadata information original spatial information remains unahcngedstatic voidmakeSpatial(Network network, java.lang.String nodeGeomColumn, java.lang.String linkGeomColumn, java.lang.String pathGeomColumn)Convert a logical network to a spatial network Note this only updates the network metadata informationstatic Networkmcst(Network network)Returns the minimum cost spanning tree (Kruskal Algorithm) as a network.static Link[]mcstLinkArray(Network network)Returns the minimum cost spanning tree (Kruskal Algorithm).static Path[]nearestNeighbors(Network network, int startNodeID, int noOfNeighbors)Returns the shortest paths of the N nearest neighbors from the start node.static Path[]nearestNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint)Returns the shortest paths of the N nearest neighbors from the start node.static Path[]nearestNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint, GoalNode goalNodeFilter)Returns the shortest paths of the N nearest neighbors from the specified start node.static Path[]nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors)Returns the shortest paths of the N nearest reaching neighbors to the specified start node.static Path[]nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors, GoalNode goalNodeFilter)Returns the shortest paths of the N nearest reaching neighbors to the specified start node.static Path[]nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint, GoalNode goalNodeFilter)Returns the shortest paths of the N nearest reaching neighbors to the specified start node.static booleannetworkExists(java.sql.Connection conn, java.lang.String network)Checks if the given network exists in the database.static PathnewPathToDestination(Network network, Path referencePath, int newStartNodeID, NetworkConstraint constraint)Creates a new path starting from the new start node to the node on the reference path closest to the start node and to the end node of the reference pathstatic java.util.HashMapreadGeometryFromDB(java.sql.Connection conn, java.lang.String tableName, java.lang.String geomColumnName, java.lang.String keyColumnName, java.lang.String[] keyIDArray)Returns Geometry from DB table in a HashaMapstatic java.lang.ObjectreadJavaObject(java.sql.Connection conn, java.lang.String name)Reads in the given Java object from the database to memorystatic NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName)Returns the read-only network from the database.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate)Returns the network from the database.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate, UserDataIO ioFunction, java.lang.String sqlNodeFilter, java.lang.String sqlLinkFilter, java.lang.String sqlPathFilter)Returns the network with regard to the given filters.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate, UserDataIO ioFunction, java.lang.String sqlNodeFilter, java.lang.String sqlLinkFilter, java.lang.String sqlPathFilter, boolean linksWithinNodeSet)Returns the network with regard to the given filters.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, int linkLevel, boolean readForUpdate)Returns the network with the specified link level.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, int linkLevel, boolean readForUpdate, UserDataIO ioFunction)Returns the network with the specified link level.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, MBR mbr, boolean readForUpdate)Returns the network that is inside the specified MBR.static NetworkreadNetwork(java.sql.Connection conn, java.lang.String networkName, MBR mbr, boolean readForUpdate, UserDataIO ioFunction)Returns the network that is inside the specified MBR.static NetworkConstraintreadNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName)Reads in the given network constraint from the database to memorystatic java.lang.ObjectreadNetworkConstraintObject(java.sql.Connection conn, java.lang.String networkConstraintName)Reads in the given network constraint from the database to memorystatic java.util.HashMapreadNetworkConstraints(java.sql.Connection conn)Reads in the network constraints owned by the current schema from the database to memorystatic java.util.HashMapreadNetworkMetadata(java.sql.Connection conn)Returns all network metadata from the database.static NetworkMetadatareadNetworkMetadata(java.sql.Connection conn, int networkID)Returns the network metadata from the database by network ID.static NetworkMetadatareadNetworkMetadata(java.sql.Connection conn, java.lang.String networkName)Returns the network metadata from the database by network name.static voidregisterJavaObject(java.sql.Connection conn, java.lang.String name, java.lang.String className, java.lang.String directoryName, java.lang.String description, java.lang.String javaInterface)Register the given Java object into user_sdo_network_java_objectsstatic voidregisterNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName, java.lang.String className, java.lang.String directoryName, java.lang.String description)Register the given network constraint into user_sdo_network_constraintsstatic voidremoveNetworkFromCache(java.lang.String networkName)Removes a network from the network cahcestatic SubPathshortestPath(Network network, int startLinkID, double startPercentage, int endLinkID, double endPercentage, NetworkConstraint constraint)Returns the shortest path as a sub pathstatic SubPathshortestPath(Network network, int startLinkID, double startPercentage, int endNodeID, NetworkConstraint constraint)Returns the shortest path as a sub pathstatic PathshortestPath(Network network, int startNodeID, int goalNodeID)Returns the shortest path based on the Dijkstra algorithm.static SubPathshortestPath(Network network, int startNodeID, int endLinkID, double endPercentage, NetworkConstraint constraint)Returns the shortest path as a sub pathstatic PathshortestPath(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint)Returns the shortest path based on the Dijkstra algorithm.static PathshortestPath(Path complexPath, NetworkConstraint constraint)Returns the shortest path based on the Dijkstra algorithm.static SubPathshortestPathAStar(Network network, int startLinkID, double startPercentage, int endLinkID, double endPercentage, NetworkConstraint constraint)Returns the shortest path as a sub path using A* algorithmstatic PathshortestPathAStar(Network network, int startNodeID, int goalNodeID)Returns the shortest path based on the A* search algorithm.static PathshortestPathAStar(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint)Returns the shortest path based on the A* search algorithm.static PathshortestPathAStar(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, AStarCostFunction userCostFunction, double searchMultiplier)Returns the shortest path based on the A* search algorithm.static SubPathshortestPathDijkstra(Network network, int startLinkID, double startPercentage, int endLinkID, double endPercentage, NetworkConstraint constraint)Returns the shortest path as a sub path using Dijkstra algorithmstatic PathshortestPathDijkstra(Network network, int startNodeID, int goalNodeID)Returns the shortest path based on the Dijkstra algorithm.static PathshortestPathDijkstra(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint)Returns the shortest path based on the Dijkstra algorithm.static PathshortestPathDijkstra(Path complexPath, NetworkConstraint constraint)Returns the shortest path based on the Dijkstra algorithm.static Path[]shortestPaths(Network network, int startNodeID)Returns all shortest paths from the given start node based on the Dijkstra algorithm.static Path[]shortestPaths(Network network, int startNodeID, NetworkConstraint constraint)Returns the shortest paths from the specified source node to any other nodes based on the Dijkstra algorithm.static SubPath[]traceIn(Network network, int endLinkID, double endPercentage, double cost, NetworkConstraint constraint)Returns trace in results in an array of SubPathstatic SubPath[]traceIn(Network network, int endNodeID, double cost, NetworkConstraint constraint)Returns trace in results in an array of SubPathstatic SubPath[]traceOut(Network network, int startLinkID, double startPercentage, double cost, NetworkConstraint constraint)Returns trace out results in an array of SubPathstatic SubPath[]traceOut(Network network, int startNodeID, double cost, NetworkConstraint constraint)Returns trace out results in an array of SubPathstatic PathtspPath(Network network, int[] nodeIDArray, boolean isClosed, boolean useExactCost, NetworkConstraint constraint)Returns a TSP tour.static PathtspPath(Network network, int[] nodeIDArray, NetworkConstraint constraint)Returns a TSP tour.static PathtspPath(Node[] nodeArray, boolean isClosed, boolean useExactCost, NetworkConstraint constraint)Returns a TSP tour.static voidupdateLinks(java.sql.Connection conn, Network network, int[] linkIDArray)Updates in-memory links from databasestatic voidupdateNetworkLinkCost(java.sql.Connection conn, Network network, java.lang.String costTableName, java.lang.String costColumnName)Updates the cost of all network links with the value of the given cost column in the given table.static voidupdateNetworkNodeCost(java.sql.Connection conn, Network network, java.lang.String costTableName, java.lang.String costColumnName)Updates the cost of all network node with the value of the given cost column in the given table.static voidupdateNodes(java.sql.Connection conn, Network network, int[] nodeIDArray)Updates in-memory nodes from databasestatic voidupdatePaths(java.sql.Connection conn, Network network, int[] pathIDArray)static voidupdateSubPaths(java.sql.Connection conn, Network network, int[] subPathIDArray)static java.lang.StringvalidateNetwork(Network network)Validates the reference relationship of the given network return the validation result as a Stringstatic java.lang.StringvalidateNetworkSchema(java.sql.Connection conn, java.lang.String networkName)Validates the network tables and reports any errors if exist.static Path[]withinCost(Network network, int startNodeID, double cost)Returns the shortest paths of the nodes that are within the specified cost from the given node.static Path[]withinCost(Network network, int startNodeID, double cost, NetworkConstraint constraint)Returns all paths that are within the specified cost.static Path[]withinReachingCost(Network network, int startNodeID, double cost)Returns all reaching paths that are within the specified cost.static Path[]withinReachingCost(Network network, int startNodeID, double cost, NetworkConstraint constraint)Returns all reaching paths that are within the specified cost.static voidwriteNetwork(java.sql.Connection conn, Network network)Writes the network to the database.static voidwriteNetwork(java.sql.Connection conn, Network network, UserDataIO ioFunction)Writes the network to the database.static voidwriteNetworkMetadata(java.sql.Connection conn, NetworkMetadata metadata)Writes the network metadata to the database.
-
-
-
Method Detail
-
getVersion
public static java.lang.String getVersion()
Returns the version of the SDO networkAdapter.- Returns:
- adapter version
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName) throws java.sql.SQLException, NetworkDataException
Returns the read-only network from the database.- Parameters:
conn- the database connectionnetworkName- the network name- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate) throws java.sql.SQLException, NetworkDataException
Returns the network from the database.- Parameters:
conn- the database connectionnetworkName- the network namereadForUpdate- the update mode if true or the read-only mode if false- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, MBR mbr, boolean readForUpdate) throws java.sql.SQLException, NetworkDataException
Returns the network that is inside the specified MBR.- Parameters:
conn- the database connectionnetworkName- the network namembr- the bounding MBRreadForUpdate- the update mode if true or the read-only mode if false- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, int linkLevel, boolean readForUpdate) throws java.sql.SQLException, NetworkDataException
Returns the network with the specified link level.- Parameters:
conn- the database connectionnetworkName- the network namelinkLevel- the link levelreadForUpdate- the update mode if true, read-only mode otherwise- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, MBR mbr, boolean readForUpdate, UserDataIO ioFunction) throws java.sql.SQLException, NetworkDataException
Returns the network that is inside the specified MBR.- Parameters:
conn- the database connectionnetworkName- the network namembr- the bounding MBRreadForUpdate- the update mode if true or the read-only mode otherwiseioFunction- the UserDataIO implementation for reading user data- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate, UserDataIO ioFunction, java.lang.String sqlNodeFilter, java.lang.String sqlLinkFilter, java.lang.String sqlPathFilter, boolean linksWithinNodeSet) throws java.sql.SQLException, NetworkDataException
Returns the network with regard to the given filters.- Parameters:
conn- the database connectionnetworkName- the network namereadForUpdate- the update mode if true or the read-only mode otherwiseioFunction- the UserDataIO implementation for reading user datasqlNodeFilter- SQL node filtersqlLinkFilter- SQL link filtersqlPathFilter- SQL path filter- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, boolean readForUpdate, UserDataIO ioFunction, java.lang.String sqlNodeFilter, java.lang.String sqlLinkFilter, java.lang.String sqlPathFilter) throws java.sql.SQLException, NetworkDataException
Returns the network with regard to the given filters.- Parameters:
conn- the database connectionnetworkName- the network namereadForUpdate- the update mode if true or the read-only mode otherwiseioFunction- the UserDataIO implementation for reading user datasqlNodeFilter- SQL node filtersqlLinkFilter- SQL link filtersqlPathFilter- SQL path filter- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetwork
public static Network readNetwork(java.sql.Connection conn, java.lang.String networkName, int linkLevel, boolean readForUpdate, UserDataIO ioFunction) throws java.sql.SQLException, NetworkDataException
Returns the network with the specified link level.- Parameters:
conn- the database connectionnetworkName- the network namelinkLevel- the link levelreadForUpdate- the update mode if true or the read-only mode otherwiseioFunction- the UserDataIO implementation for reading user data- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetworkMetadata
public static java.util.HashMap readNetworkMetadata(java.sql.Connection conn) throws java.sql.SQLException, NetworkDataExceptionReturns all network metadata from the database.- Parameters:
conn- the database connection- Returns:
- a HashMap with the network names as keys and NetworkMetadata as values
- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetworkMetadata
public static NetworkMetadata readNetworkMetadata(java.sql.Connection conn, java.lang.String networkName) throws java.sql.SQLException, NetworkDataException
Returns the network metadata from the database by network name.- Parameters:
conn- the database connectionnetworkName- the network name- Returns:
- a NetworkMetadata
- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetworkMetadata
public static NetworkMetadata readNetworkMetadata(java.sql.Connection conn, int networkID) throws java.sql.SQLException, NetworkDataException
Returns the network metadata from the database by network ID.- Parameters:
conn- the database connectionnetworkID- the network name- Returns:
- NetworkMetadata
- Throws:
java.sql.SQLExceptionNetworkDataException
-
writeNetworkMetadata
public static void writeNetworkMetadata(java.sql.Connection conn, NetworkMetadata metadata) throws java.sql.SQLException, NetworkDataExceptionWrites the network metadata to the database.- Parameters:
conn- the database connectionmetadata- the network metadata- Throws:
java.sql.SQLExceptionNetworkDataException
-
writeNetwork
public static void writeNetwork(java.sql.Connection conn, Network network) throws java.sql.SQLException, NetworkDataExceptionWrites the network to the database.- Parameters:
conn- the database connectionnetwork- the specified network- Throws:
java.sql.SQLExceptionNetworkDataException
-
writeNetwork
public static void writeNetwork(java.sql.Connection conn, Network network, UserDataIO ioFunction) throws java.sql.SQLException, NetworkDataExceptionWrites the network to the database.- Parameters:
conn- the database connectionnetwork- the specified networkioFunction- the UserDataIO implementation for writing user data- Throws:
java.sql.SQLExceptionNetworkDataException
-
readNetworkConstraints
public static java.util.HashMap readNetworkConstraints(java.sql.Connection conn) throws java.sql.SQLException, NetworkDataException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessExceptionReads in the network constraints owned by the current schema from the database to memory- Parameters:
conn- database connection- Returns:
- the desired network constraints in a HashMap with constraint name as keys and constraint classes as values
- Throws:
java.sql.SQLExceptionNetworkDataExceptionjava.lang.ClassNotFoundExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
readNetworkConstraint
public static NetworkConstraint readNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName) throws java.sql.SQLException, NetworkDataException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
Reads in the given network constraint from the database to memory- Parameters:
conn- database connectionnetworkConstraintName- the name of the network constraint- Returns:
- the desired network constraint
- Throws:
java.sql.SQLExceptionNetworkDataExceptionjava.lang.ClassNotFoundExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
readNetworkConstraintObject
public static java.lang.Object readNetworkConstraintObject(java.sql.Connection conn, java.lang.String networkConstraintName) throws java.sql.SQLException, NetworkDataException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessExceptionReads in the given network constraint from the database to memory- Parameters:
conn- database connectionnetworkConstraintName- the name of the network constraint- Returns:
- the desired network constraint
- Throws:
java.sql.SQLExceptionNetworkDataExceptionjava.lang.ClassNotFoundExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
readJavaObject
public static java.lang.Object readJavaObject(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException, NetworkDataException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessExceptionReads in the given Java object from the database to memory- Parameters:
conn- database connectionname- the name of the Java object in user_sdo_network_java_objects- Returns:
- the desired java object
- Throws:
java.sql.SQLExceptionNetworkDataExceptionjava.lang.ClassNotFoundExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessException
-
registerNetworkConstraint
public static void registerNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName, java.lang.String className, java.lang.String directoryName, java.lang.String description) throws java.sql.SQLException, NetworkDataExceptionRegister the given network constraint into user_sdo_network_constraints- Parameters:
conn- database connectionnetworkConstraintName- constraint nameclassName- Should be given without suffix ".class"directoryName- Must be the name of a valid Oracle directory objectdescription-- Throws:
java.sql.SQLExceptionNetworkDataException
-
deregisterNetworkConstraint
public static void deregisterNetworkConstraint(java.sql.Connection conn, java.lang.String networkConstraintName) throws java.sql.SQLException, NetworkDataExceptionDeregister the given constraint from user_sdo_network_constraints- Parameters:
conn- database connectionnetworkConstraintName- constraint name- Throws:
java.sql.SQLExceptionNetworkDataException
-
registerJavaObject
public static void registerJavaObject(java.sql.Connection conn, java.lang.String name, java.lang.String className, java.lang.String directoryName, java.lang.String description, java.lang.String javaInterface) throws java.sql.SQLException, NetworkDataExceptionRegister the given Java object into user_sdo_network_java_objects- Parameters:
conn- database connectionname- name of object in user_sdo_network_java_classesclassName- Should be given without suffix ".class"directoryName- Must be the name of a valid Oracle directory objectdescription- object descriptionjavaInterface- Java interface implemented by this Java object- Throws:
java.sql.SQLExceptionNetworkDataException
-
deregisterJavaObject
public static void deregisterJavaObject(java.sql.Connection conn, java.lang.String name) throws java.sql.SQLException, NetworkDataExceptionDeregister the given Java object from user_sdo_network_java_objects- Parameters:
conn- database connectionname- name of object in user_sdo_network_java_classes- Throws:
java.sql.SQLExceptionNetworkDataException
-
mcst
public static Network mcst(Network network)
Returns the minimum cost spanning tree (Kruskal Algorithm) as a network.- Parameters:
network- the specified network
-
mcstLinkArray
public static Link[] mcstLinkArray(Network network)
Returns the minimum cost spanning tree (Kruskal Algorithm). as an array of links.- Parameters:
network- the specified network
-
isReachable
public static boolean isReachable(Network network, int sourceNodeID, int targetNodeID, MBR mbr, int depthLimit) throws NetworkDataException
Checks if the source node can reach the target node.- Parameters:
network- the specified networksourceNodeID- the source node IDtargetNodeID- the target node IDmbr- the bounding MBRdepthLimit- the depth limit- Returns:
- true if reachable or false otherwise
- Throws:
NetworkDataException
-
isReachable
public static boolean isReachable(Network network, int sourceNodeID, int targetNodeID) throws NetworkDataException
Checks if the source node can reach the target node.- Parameters:
network- the specified networksourceNodeID- the source node IDtargetNodeID- the target node ID- Returns:
- true if reachable or false otherwise
- Throws:
NetworkDataException
-
isReachable
public static boolean isReachable(Network network, int sourceNodeID, int targetNodeID, NetworkConstraint constraint) throws NetworkDataException
Checks if the source node can reach the target node.- Parameters:
network- the specified networksourceNodeID- the source node IDtargetNodeID- the target node IDconstraint- the network constraint- Returns:
- true if reachable or false otherwise
- Throws:
NetworkDataException
-
findConnectedComponents
public static int findConnectedComponents(Network network)
Returns the number of connected components in the network. The component number of each node will be set. The component number can be obtained using getComponentNo() from a node. Nodes that belong to the same component have the same component number. Note this function is not thread safe as it sets the component number of each node.- Parameters:
network- the specified network
-
findConnectedComponentVector
public static java.util.Vector findConnectedComponentVector(Network network)
Returns connected components of the network in a Vector. The number of connected components is the size of the return Vector. Each connected component is returned as a HashSet containing all nodes in the Vector. Note this function is thread safe and no Node component number will be set.- Parameters:
network- the specified network
-
findReachableNodes
public static Node[] findReachableNodes(Network network, int sourceNodeID) throws NetworkDataException
Returns all nodes that can be reached from the source node.- Parameters:
network- the specified networksourceNodeID- the source node ID- Throws:
NetworkDataException
-
findReachableNodes
public static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr) throws NetworkDataException
Returns all nodes that can be reached from the source node.- Parameters:
network- the specified networksourceNodeID- the source node IDmbr- the bounding MBR- Returns:
- an array of nodes that can be reached
- Throws:
NetworkDataException
-
findReachableNodes
public static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit) throws NetworkDataException
Returns all nodes that can be reached from the source node.- Parameters:
network- the specified networksourceNodeID- the source node IDmbr- the MBRdepthLimit- the depth limit- Returns:
- an array of nodes that can be reached
- Throws:
NetworkDataException
-
findReachableNodes
public static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit, int maxNoOfNodes) throws NetworkDataException
Returns all nodes that can be reached from the source node.- Parameters:
network- the specified networksourceNodeID- the source node IDmbr- the MBRdepthLimit- the depth limitmaxNoOfNodes- max. no of nodes returned- Returns:
- an array of nodes that can be reached
- Throws:
NetworkDataException
-
findReachableNodes
public static Node[] findReachableNodes(Network network, int sourceNodeID, MBR mbr, int depthLimit, NetworkConstraint constraint, int maxNoOfNodes) throws NetworkDataException
Returns all nodes that can be reached from the source node.- Parameters:
network- the specified networksourceNodeID- the source node IDmbr- the MBRdepthLimit- the depth limitconstraint- network constraintmaxNoOfNodes- max. no of nodes returned- Returns:
- an array of nodes that can be reached
- Throws:
NetworkDataException
-
findReachableNodes
public static Node[] findReachableNodes(Network network, int sourceNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns all nodes that can be reached from the source node.- Parameters:
network- the specified networksourceNodeID- the source node IDconstraint- the network constraint- Returns:
- an array of nodes that can be reached
- Throws:
NetworkDataException
-
findReachingNodes
public static Node[] findReachingNodes(Network network, int targetNodeID) throws NetworkDataException
Returns all nodes that can reach the target node.- Parameters:
network- the specified networktargetNodeID- the target node ID- Returns:
- an array of nodes that can reach the target node
- Throws:
NetworkDataException
-
findReachingNodes
public static Node[] findReachingNodes(Network network, int targetNodeID, MBR mbr) throws NetworkDataException
Returns all nodes that can reach the target node.- Parameters:
network- the specified networktargetNodeID- the target node IDmbr- the MBR- Returns:
- an array of nodes that can reach the target node
- Throws:
NetworkDataException
-
findReachingNodes
public static Node[] findReachingNodes(Network network, int targetNodeID, MBR mbr, int depthLimit) throws NetworkDataException
Returns all nodes that can reach the target node.- Parameters:
network- the specified networktargetNodeID- the target node IDmbr- the MBRdepthLimit- the depth limit- Returns:
- an array of nodes that can reach the target node
- Throws:
NetworkDataException
-
findReachingNodes
public static Node[] findReachingNodes(Network network, int targetNodeID, MBR mbr, int depthLimit, NetworkConstraint constraint, int maxNoOfNodes) throws NetworkDataException
Returns all nodes that can reach the target node.- Parameters:
network- the specified networktargetNodeID- the target node IDmbr- the MBRdepthLimit- the depth limitconstraint- network constraintmaxNoOfNodes- max. no. of nodes returned- Returns:
- an array of nodes that can reach the target node
- Throws:
NetworkDataException
-
findReachingNodes
public static Node[] findReachingNodes(Network network, int targetNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns all nodes that can reach the target node.- Parameters:
network- the specified networktargetNodeID- the target node IDconstraint- the network constraint- Returns:
- an array of nodes that can reach the target node
- Throws:
NetworkDataException
-
shortestPathAStar
public static Path shortestPathAStar(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, AStarCostFunction userCostFunction, double searchMultiplier) throws NetworkDataException
Returns the shortest path based on the A* search algorithm.- Parameters:
network- the specified networkstartNodeID- the start node IDgoalNodeID- the goal node IDconstraint- the network constraint, null if noneuserCostFunction- a user-defined A* heuristic cost functionsearchMultiplier- a multiplier that applied to the user cost (default = 1.0)- Throws:
NetworkDataException
-
shortestPathAStar
public static Path shortestPathAStar(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path based on the A* search algorithm.- Parameters:
network- the specified networkstartNodeID- the start node IDgoalNodeID- the goal node IDconstraint- the network constraint, null if none- Throws:
NetworkDataException
-
shortestPathAStar
public static SubPath shortestPathAStar(Network network, int startLinkID, double startPercentage, int endLinkID, double endPercentage, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path as a sub path using A* algorithm- Parameters:
network- target networkstartLinkID- start link IDstartPercentage- start percentage [0,1]endLinkID- end link IDendPercentage- end percentage [0,1]constraint- network constraint- Returns:
- SubPath
- Throws:
NetworkDataException
-
shortestPathAStar
public static Path shortestPathAStar(Network network, int startNodeID, int goalNodeID) throws NetworkDataException
Returns the shortest path based on the A* search algorithm.- Parameters:
network- the specified networkstartNodeID- the start node IDgoalNodeID- the goal node ID- Throws:
NetworkDataException
-
shortestPath
public static Path shortestPath(Network network, int startNodeID, int goalNodeID) throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.- Parameters:
network- the specified networkstartNodeID- the start node IDgoalNodeID- the goal node ID- Throws:
NetworkDataException
-
shortestPath
public static Path shortestPath(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.- Parameters:
network- the given networkstartNodeID- the start node IDgoalNodeID- the goal node IDconstraint- the network constraint, null if none- Throws:
NetworkDataException
-
shortestPath
public static SubPath shortestPath(Network network, int startLinkID, double startPercentage, int endLinkID, double endPercentage, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path as a sub path- Parameters:
network- target networkstartLinkID- start link IDstartPercentage- start percentage [0,1]endLinkID- end link IDendPercentage- end percentage [0,1]constraint- network constraint- Returns:
- SubPath
- Throws:
NetworkDataException
-
shortestPath
public static SubPath shortestPath(Network network, int startNodeID, int endLinkID, double endPercentage, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path as a sub path- Parameters:
network- target networkstartNodeID- start node IDendLinkID- end link IDendPercentage- end percentage [0,1]constraint- network constraint- Returns:
- SubPath
- Throws:
NetworkDataException
-
shortestPath
public static SubPath shortestPath(Network network, int startLinkID, double startPercentage, int endNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path as a sub path- Parameters:
network- target networkstartLinkID- start link IDstartPercentage- start percentage [0,1]endNodeID- end node IDconstraint- network constraint- Returns:
- SubPath
- Throws:
NetworkDataException
-
shortestPath
public static Path shortestPath(Path complexPath, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.- Parameters:
complexPath- the given complex pathconstraint- the network constraint, null if none- Throws:
NetworkDataException
-
shortestPathDijkstra
public static Path shortestPathDijkstra(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.- Parameters:
network- the given networkstartNodeID- the start node IDgoalNodeID- the goal node IDconstraint- the network constraint, null if none- Throws:
NetworkDataException
-
shortestPathDijkstra
public static SubPath shortestPathDijkstra(Network network, int startLinkID, double startPercentage, int endLinkID, double endPercentage, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path as a sub path using Dijkstra algorithm- Parameters:
network- target networkstartLinkID- start link IDstartPercentage- start percentage [0,1]endLinkID- end link IDendPercentage- end percentage [0,1]constraint- network constraint- Returns:
- SubPath
- Throws:
NetworkDataException
-
shortestPathDijkstra
public static Path shortestPathDijkstra(Network network, int startNodeID, int goalNodeID) throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.- Parameters:
network- the given networkstartNodeID- the start node IDgoalNodeID- the goal node ID- Throws:
NetworkDataException
-
shortestPathDijkstra
public static Path shortestPathDijkstra(Path complexPath, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest path based on the Dijkstra algorithm.- Parameters:
complexPath- the given complex pathconstraint- the network constraint, null if none- Throws:
NetworkDataException
-
shortestPaths
public static Path[] shortestPaths(Network network, int startNodeID, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest paths from the specified source node to any other nodes based on the Dijkstra algorithm.- Parameters:
network- the given networkstartNodeID- the start node IDconstraint- the network constraint, null if none- Returns:
- an array of all shortest paths from given start node
- Throws:
NetworkDataException
-
shortestPaths
public static Path[] shortestPaths(Network network, int startNodeID) throws NetworkDataException
Returns all shortest paths from the given start node based on the Dijkstra algorithm.- Parameters:
network- the given networkstartNodeID- the start node ID- Returns:
- an array of all shortest paths from given start node
- Throws:
NetworkDataException
-
allPaths
public static Path[] allPaths(Network network, int startNodeID, int goalNodeID, int depthLimit, double costLimit, int noOfSolutions) throws NetworkDataException
Returns all paths between the start node and the goal node.- Parameters:
network- the given networkstartNodeID- the start node IDgoalNodeID- the goal node IDdepthLimit- the depth limitcostLimit- the cost limitnoOfSolutions- the number of solutions specified- Returns:
- an array of all paths from the start node to the goal node
- Throws:
NetworkDataException
-
allPaths
public static Path[] allPaths(Network network, int startNodeID, int goalNodeID, NetworkConstraint constraint, int noOfSolutions) throws NetworkDataException
Returns all paths between the start node and the goal node.- Parameters:
network- the given networkstartNodeID- the start node IDgoalNodeID- the goal node IDconstraint- the network constraintnoOfSolutions- the number of solutions specified- Returns:
- an array of all paths from the start node to the goal node
- Throws:
NetworkDataException
-
allPaths
public static Path[] allPaths(Path complexPath, int depthLimit, double costLimit, int noOfSolutions) throws NetworkDataException
Returns all paths between the start node and the goal node of the complex path.- Parameters:
complexPath- the given complex pathdepthLimit- the depth limitcostLimit- the cost limit- Returns:
- an array of all paths from given start node to the goal node
- Throws:
NetworkDataException
-
withinCost
public static Path[] withinCost(Network network, int startNodeID, double cost, NetworkConstraint constraint) throws NetworkDataException
Returns all paths that are within the specified cost.- Parameters:
network- the given networkstartNodeID- the start node IDcost- the cost limitconstraint- the network constraint, null if none- Returns:
- all paths from the start node bound by the given cost
- Throws:
NetworkDataException
-
withinCost
public static Path[] withinCost(Network network, int startNodeID, double cost) throws NetworkDataException
Returns the shortest paths of the nodes that are within the specified cost from the given node.- Parameters:
network- the given networkstartNodeID- the start node IDcost- the cost limit- Returns:
- all paths from the start node bound by the given cost
- Throws:
NetworkDataException
-
withinReachingCost
public static Path[] withinReachingCost(Network network, int startNodeID, double cost) throws NetworkDataException
Returns all reaching paths that are within the specified cost.- Parameters:
network- the given networkstartNodeID- the start node IDcost- the cost limit- Returns:
- all paths from the start node bound by the given cost
- Throws:
NetworkDataException
-
withinReachingCost
public static Path[] withinReachingCost(Network network, int startNodeID, double cost, NetworkConstraint constraint) throws NetworkDataException
Returns all reaching paths that are within the specified cost.- Parameters:
network- the given networkstartNodeID- the start node IDcost- the cost limitconstraint- the network constraint, null if none- Returns:
- all paths from the start node bound by the given cost
- Throws:
NetworkDataException
-
nearestNeighbors
public static Path[] nearestNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint, GoalNode goalNodeFilter) throws NetworkDataException
Returns the shortest paths of the N nearest neighbors from the specified start node. and goal node filter- Parameters:
network- the given networkstartNodeID- the start node IDnoOfNeighbors- the number of neighborsconstraint- the network constraintgoalNodeFilter- the goal node filter- Returns:
- an array of paths of the nearest neighbors
- Throws:
NetworkDataException
-
nearestNeighbors
public static Path[] nearestNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint) throws NetworkDataException
Returns the shortest paths of the N nearest neighbors from the start node.- Parameters:
network- the given networkstartNodeID- the start node IDnoOfNeighbors- the number of neighborsconstraint- the network constraint- Returns:
- an array of paths of the nearest neighbors
- Throws:
NetworkDataException
-
nearestNeighbors
public static Path[] nearestNeighbors(Network network, int startNodeID, int noOfNeighbors) throws NetworkDataException
Returns the shortest paths of the N nearest neighbors from the start node.- Parameters:
network- the given networkstartNodeID- the start node IDnoOfNeighbors- the number of neighbors- Returns:
- an array of paths of the nearest neighbors
- Throws:
NetworkDataException
-
nearestReachingNeighbors
public static Path[] nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors, NetworkConstraint constraint, GoalNode goalNodeFilter) throws NetworkDataException
Returns the shortest paths of the N nearest reaching neighbors to the specified start node. and goal node filter- Parameters:
network- the given networkstartNodeID- the start node IDnoOfNeighbors- the number of neighborsconstraint- the network constraintgoalNodeFilter- the goal node filter- Returns:
- an array of paths of the nearest neighbors
- Throws:
NetworkDataException
-
nearestReachingNeighbors
public static Path[] nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors, GoalNode goalNodeFilter) throws NetworkDataException
Returns the shortest paths of the N nearest reaching neighbors to the specified start node. and goal node filter- Parameters:
network- the given networkstartNodeID- the start node IDnoOfNeighbors- the number of neighborsgoalNodeFilter- the goal node filter- Returns:
- an array of paths of the nearest neighbors
- Throws:
NetworkDataException
-
nearestReachingNeighbors
public static Path[] nearestReachingNeighbors(Network network, int startNodeID, int noOfNeighbors) throws NetworkDataException
Returns the shortest paths of the N nearest reaching neighbors to the specified start node. and goal node filter- Parameters:
network- the given networkstartNodeID- the start node IDnoOfNeighbors- the number of neighbors- Returns:
- an array of paths of the nearest neighbors
- Throws:
NetworkDataException
-
validateNetworkSchema
public static java.lang.String validateNetworkSchema(java.sql.Connection conn, java.lang.String networkName)Validates the network tables and reports any errors if exist.- Returns:
- "TRUE" if no errors, return the specific error message otherwise
-
networkExists
public static boolean networkExists(java.sql.Connection conn, java.lang.String network) throws java.sql.SQLExceptionChecks if the given network exists in the database.- Parameters:
conn- the database connectionnetworkName- the network name- Returns:
- true if network exists, false otherwise
- Throws:
java.sql.SQLException
-
dropNetwork
public static void dropNetwork(java.sql.Connection conn, java.lang.String network) throws java.sql.SQLExceptionDrops the network from the database.- Parameters:
conn- the database connectionnetworkName- the network to be dropped- Throws:
java.sql.SQLException
-
createNetworkHiearchy
public static void createNetworkHiearchy(Network network, int numHierarchy, int[] ndNumLevel) throws NetworkDataException, java.sql.SQLException
Creates a network hiearchy with the given number of levels. This operation stops when the givne number of hierarchy levels has been built or it can not achieve the meaningful reduction of node numbers from one level to the next level. In the latter case, the resultant number of hierarchy levels can be less than the given number of hierarchy levels.- Parameters:
network- the network whose hierarchy will be built. The assumption is that no hierarchy exists in this network before invoking this function.numHierarchy- the extra number of hierarchy levels for this network. This number should be greater than one and less than the number o nodes in the given network. Since we assume the original network is at the level 1, after this operation, we will have numHierarchy+1 levels of network hierarchy. specifies the additional numHierarchy levels on top of the original network which is at the level one.ndNumLevel- the number of nodes specified at each level. Here the node number should decrease with the increase of the level as we assume the original network is at the bottom level, i.e. level 1.- Throws:
NetworkDataExceptionjava.sql.SQLException
-
createRefConstraints
public static void createRefConstraints(java.sql.Connection conn, java.lang.String network) throws java.sql.SQLExceptionCreates the referential constraints on the link and the path tables. When the constraints are created, they are enabled by default and can be disabled later.- Parameters:
conn- the database connectionnetworkName- the network name- Throws:
java.sql.SQLException
-
enableRefConstraints
public static void enableRefConstraints(java.sql.Connection conn, java.lang.String network) throws java.sql.SQLExceptionEnables the referential constraints on the link and the path tables.- Parameters:
conn- the database connectionnetworkName- the network name- Throws:
java.sql.SQLException
-
getMaxFlow
public static long getMaxFlow(Network network, int sourceNodeID, int sinkNodeID, java.util.Vector linkFlowVec) throws NetworkDataException, java.io.IOException
Retunrs the max flow between the source node and the sink node- Parameters:
network- network to be analyzedsourceNodeID- source Node IDsinkNodeID- sink node IDlinkFlowVec- link flow returned in a Vector- Returns:
- the max. flow
- Throws:
NetworkDataExceptionjava.io.IOException
-
disableRefConstraints
public static void disableRefConstraints(java.sql.Connection conn, java.lang.String network) throws java.sql.SQLExceptionDisables the referential constraints on the link and the path tables.- Parameters:
conn- the database connectionnetworkName- the network name- Throws:
java.sql.SQLException
-
dropRefConstraints
public static void dropRefConstraints(java.sql.Connection conn, java.lang.String network) throws java.sql.SQLExceptionDrops the referential constraints on the link and the path tables.- Parameters:
conn- the database connectionnetworkName- the network name- Throws:
java.sql.SQLException
-
findMBR
public static MBR findMBR(Node[] nodeArray, double expandFactor)
Returns the MBR of the node array and expanded it by the specified factor.
-
tspPath
public static Path tspPath(Network network, int[] nodeIDArray, NetworkConstraint constraint) throws NetworkDataException
Returns a TSP tour.- Parameters:
network- the specified networknodeIDArray- an array containing IDs of nodes to be visitedconstraint- the network constraint- Throws:
NetworkDataException
-
tspPath
public static Path tspPath(Network network, int[] nodeIDArray, boolean isClosed, boolean useExactCost, NetworkConstraint constraint) throws NetworkDataException
Returns a TSP tour.- Parameters:
network- the specified networknodeIDArray- an array containing IDs of nodes to be visitedisClosed- is the tour is closed?useExactCost- if true, use the real cost, use the Cartesian distance otherwiseconstraint- the network constraint- Throws:
NetworkDataException
-
tspPath
public static Path tspPath(Node[] nodeArray, boolean isClosed, boolean useExactCost, NetworkConstraint constraint) throws NetworkDataException
Returns a TSP tour.- Parameters:
nodeArray- an array containing nodes to be visitedisClosed- is the tour closed?useExactCost- if true, use the real cost, use the Cartesian distance otherwiseconstraint- network constraint- Throws:
NetworkDataException
-
findInternalLinks
public static Link[] findInternalLinks(Node[] nodeArray)
Returns the internal links of the node array. Internal links are the links that connect the nodes in the specified array
-
findExternalLinks
public static Link[] findExternalLinks(Node[] nodeArray1, Node[] nodeArray2)
Returns external links between the two arrays of nodes. External links are the links that connect the nodes in the specified node arrays.
-
makeSpatial
public static void makeSpatial(Network network, java.lang.String nodeGeomColumn, java.lang.String linkGeomColumn, java.lang.String pathGeomColumn)
Convert a logical network to a spatial network Note this only updates the network metadata information- Parameters:
network- network to be convertednodeGeomColumn- geometry column name for node tablelinkGeomColumn- geometry column name for link tablepathGeomColumn- geometry column name for path table
-
makeLogical
public static void makeLogical(Network network)
Convert a spatial network to a logical network Note this only updates the network metadata information original spatial information remains unahcnged- Parameters:
network- network to be converted
-
insertGeomMetadata
public static void insertGeomMetadata(java.sql.Connection conn, java.lang.String tableName, java.lang.String geomColumnName, int srid, SDODimArray dimArray) throws java.sql.SQLExceptionInserts the geometry metadata to the database.- Parameters:
conn- the database connectiontableName- the geometry table namegeomColumnName- the geometry column namesrid- the SRIDdimArray- the SDODimArray- Throws:
java.sql.SQLException
-
getNetworkNameFromID
public static java.lang.String getNetworkNameFromID(java.sql.Connection conn, int networkID) throws java.sql.SQLExceptionReturns the network name from a given network ID- Parameters:
conn- the database connectionnetworkID- the network ID- Throws:
java.sql.SQLException
-
getNetworkIDFromName
public static int getNetworkIDFromName(java.sql.Connection conn, java.lang.String networkName) throws java.sql.SQLExceptionReturns the network ID from a given network name- Parameters:
conn- the database connectionnetworkName- the network name- Throws:
java.sql.SQLException
-
getNetworkNames
public static java.util.HashMap getNetworkNames(java.sql.Connection conn) throws java.sql.SQLExceptionRetunrs network names and IDs from the database. The result is in a HashMap with names as keys and IDs as values (Integers)- Parameters:
conn- the database connection- Returns:
- a HashMap with network names as keys and IDs as values
- Throws:
java.sql.SQLException
-
getNetworkIDs
public static java.util.HashMap getNetworkIDs(java.sql.Connection conn) throws java.sql.SQLExceptionRetunrs network names and IDs from the database. The result is in a HashMap with IDs as keys (Integers) and names as values- Parameters:
conn- the database connection- Returns:
- a HashMap with network IDs as keys and names as values
- Throws:
java.sql.SQLException
-
isNetworkPartitioned
public static boolean isNetworkPartitioned(java.sql.Connection conn, java.lang.String networkName) throws NetworkDataException, java.sql.SQLExceptionReturns the partition ID of the given node- Parameters:
conn- database connectionnetworkName- network name in databasenodeID- given node ID- Throws:
NetworkDataExceptionjava.sql.SQLException
-
validateNetwork
public static java.lang.String validateNetwork(Network network)
Validates the reference relationship of the given network return the validation result as a String
-
isNetworkInCache
public static boolean isNetworkInCache(java.lang.String networkName)
Checks if a given network is in the cache- Parameters:
networkName- the given network name
-
getNetworkFromCache
public static Network getNetworkFromCache(java.lang.String networkName)
Gets the network from the network cache if the specified network is not in the cache, null will be returned To add a network in the cache, use Networkmanager.putNetworkToCache(networkname, network)- Parameters:
networkName- network name
-
addNetworkToCache
public static void addNetworkToCache(java.lang.String networkName, Network network)Adds a network in the network cahce- Parameters:
networkName- network namenetwork- network to be cached
-
removeNetworkFromCache
public static void removeNetworkFromCache(java.lang.String networkName)
Removes a network from the network cahce- Parameters:
networkName- network name
-
getNetworkCacheMap
public static java.util.HashMap getNetworkCacheMap()
Returns the network cache as a HashMap with network name (type: String) as keys and networks (type: Network) as values
-
clearNetworkCache
public static void clearNetworkCache()
Clears the network cache
-
findNodesWithinDegreeBounds
public static Node[] findNodesWithinDegreeBounds(Network network, int degreeType, int minDegree, int maxDegree)
Finds nodes with degree within the given degree bounds. Note the result will be sorted accoding to the degree in a decreasing order.- Parameters:
degreeType- type of node degree, -1 : in-degree, 1: out-degree and 0: degreeminDegree- minmum node degreemaxDegree- maximum node degree
-
findMaxNodeDegree
public static int findMaxNodeDegree(Network network, int degreeType)
Finds the maximum node degree of the network- Parameters:
degreeType- type of node degree, -1 : in-degree, 1: out-degree and 0: degree
-
findMinNodeDegree
public static int findMinNodeDegree(Network network, int degreeType)
Finds the minimum node degree of the network- Parameters:
degreeType- type of node degree, -1 : in-degree, 1: out-degree and 0: degree
-
traceOut
public static SubPath[] traceOut(Network network, int startNodeID, double cost, NetworkConstraint constraint) throws NetworkDataException
Returns trace out results in an array of SubPath- Parameters:
network- target networkstartNodeID- start node for trace outcost- trace out cost limitconstraint- network constraint- Returns:
- an array of SubPath
- Throws:
NetworkDataException
-
traceOut
public static SubPath[] traceOut(Network network, int startLinkID, double startPercentage, double cost, NetworkConstraint constraint) throws NetworkDataException
Returns trace out results in an array of SubPath- Parameters:
network- target networkstartLinkID- start link IDstartPercentage- start percentage [0,1]cost- trace out cost limitconstraint- network constraint- Returns:
- an array of SubPath
- Throws:
NetworkDataException
-
traceIn
public static SubPath[] traceIn(Network network, int endNodeID, double cost, NetworkConstraint constraint) throws NetworkDataException
Returns trace in results in an array of SubPath- Parameters:
network- target networkendNodeID- end node for trace outcost- trace in cost limitconstraint- network constraint- Returns:
- an array of SubPath
- Throws:
NetworkDataException
-
traceIn
public static SubPath[] traceIn(Network network, int endLinkID, double endPercentage, double cost, NetworkConstraint constraint) throws NetworkDataException
Returns trace in results in an array of SubPath- Parameters:
network- target networkendLinkID- end link IDendPercentage- end percentagecost- trace in cost limitconstraint- network constraint- Returns:
- an array of SubPath
- Throws:
NetworkDataException
-
readGeometryFromDB
public static java.util.HashMap readGeometryFromDB(java.sql.Connection conn, java.lang.String tableName, java.lang.String geomColumnName, java.lang.String keyColumnName, java.lang.String[] keyIDArray) throws java.sql.SQLExceptionReturns Geometry from DB table in a HashaMap- Parameters:
conn- jdbc connectiontableName- geometry table namegeomColumnName- geometry column namekeyColumnName- key column namekeyIDArray- key IDarray- Returns:
- HashMap hash map containing key IDs as keys and JGeometry as values
- Throws:
java.sql.SQLException
-
updateNodes
public static void updateNodes(java.sql.Connection conn, Network network, int[] nodeIDArray) throws java.sql.SQLException, NetworkDataExceptionUpdates in-memory nodes from database- Parameters:
conn- jdbc connectionnetwork- target networknodeIDArray- ID array of the nodes to be updated- Throws:
java.sql.SQLExceptionNetworkDataException
-
updateLinks
public static void updateLinks(java.sql.Connection conn, Network network, int[] linkIDArray) throws java.sql.SQLException, NetworkDataExceptionUpdates in-memory links from database- Parameters:
conn- jdbc connectionnetwork- target networklinkIDArray- ID array of the links to be updated- Throws:
java.sql.SQLExceptionNetworkDataException
-
updatePaths
public static void updatePaths(java.sql.Connection conn, Network network, int[] pathIDArray) throws java.sql.SQLException, NetworkDataException- Throws:
java.sql.SQLExceptionNetworkDataException
-
updateSubPaths
public static void updateSubPaths(java.sql.Connection conn, Network network, int[] subPathIDArray) throws java.sql.SQLException, NetworkDataException- Throws:
java.sql.SQLExceptionNetworkDataException
-
getPathGeomFromDB
public JGeometry getPathGeomFromDB(java.sql.Connection conn, Network network, Path path, java.lang.String linkTableName, java.lang.String linkGeomColumnName, java.lang.String nodeTableName, java.lang.String nodeGeomColumnName, double tolerance) throws java.sql.SQLException, NetworkDataException
Gets/Computes the path geometry based on the geometries of path links and nodes in the database- Parameters:
conn- jdbc connectionnetwork- target networkpath- target pathlinkTableName- link table namelinkGeomColumnName- link geometry column namenodeTableName- node table namenodeGeomColumnName- node geometry column nametolerance- tolerance for geometric connectivity- Returns:
- path geometry
- Throws:
java.sql.SQLExceptionNetworkDataException
-
updateNetworkLinkCost
public static void updateNetworkLinkCost(java.sql.Connection conn, Network network, java.lang.String costTableName, java.lang.String costColumnName) throws java.sql.SQLException, NetworkDataExceptionUpdates the cost of all network links with the value of the given cost column in the given table. This function only updates the cost of the links in the network- Parameters:
conn- databae connectionnetwork- target networkcostTableName- given cost table name. must have LINK_ID as primary key. if null network link table name will be usedcostColumnName- given cost column name in the cost table. must be numeric data type- Throws:
java.sql.SQLExceptionNetworkDataException
-
updateNetworkNodeCost
public static void updateNetworkNodeCost(java.sql.Connection conn, Network network, java.lang.String costTableName, java.lang.String costColumnName) throws java.sql.SQLException, NetworkDataExceptionUpdates the cost of all network node with the value of the given cost column in the given table. This function only updates the cost of the nodes in the network- Parameters:
conn- databae connectionnetwork- target networkcostTableName- given cost table name. must have NODE_ID as primary key. if null network node table name will be usedcostColumnName- given cost column name in the cost table. must be of numeric data type- Throws:
java.sql.SQLExceptionNetworkDataException
-
convertNetworkBetweenWorkspaces
public static Network convertNetworkBetweenWorkspaces(java.sql.Connection conn, Network sourceNetwork, java.lang.String sourceWorkspace, java.lang.String sourceSavepoint, java.lang.String targetWorkspace, java.lang.String targetSavepoint) throws java.sql.SQLException, NetworkDataException
Converts the source network into the network in the target workspace and savepoint based on their diffs in a workspace(version-enabled) environment.- Parameters:
conn- database connectionsourceNetwork- network in (sourceWorkspace,sourceSavepoint)sourceWorkspace- source workspacesourceSavepoint- source savepoint, "LATEST" if nulltargetWorkspace- target workspacetargetSavepoint- target savepoint, "LATEST" if null- Returns:
- network in the target workspace and savepoint
- Throws:
java.sql.SQLExceptionNetworkDataException
-
newPathToDestination
public static Path newPathToDestination(Network network, Path referencePath, int newStartNodeID, NetworkConstraint constraint) throws NetworkDataException
Creates a new path starting from the new start node to the node on the reference path closest to the start node and to the end node of the reference path- Parameters:
network- target networkreferencePath- reference pathnewStartNodeID- new start node IDconstraint- constraint- Returns:
- new path
- Throws:
NetworkDataException
-
-