Package org.insa.graphs.model
Class Path
java.lang.Object
org.insa.graphs.model.Path
public class Path
extends java.lang.Object
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static Path
concatenate(Path... paths)
Concatenate the given paths.static Path
createFastestPathFromNodes(Graph graph, java.util.List<Node> nodes)
Deprecated.Need to be implemented.static Path
createShortestPathFromNodes(Graph graph, java.util.List<Node> nodes)
Deprecated.Need to be implemented.java.util.List<Arc>
getArcs()
Node
getDestination()
Graph
getGraph()
float
getLength()
Deprecated.Need to be implemented.double
getMinimumTravelTime()
Deprecated.Need to be implemented.Node
getOrigin()
double
getTravelTime(double speed)
Deprecated.Need to be implemented.boolean
isEmpty()
Check if this path is empty (it does not contain any node).boolean
isValid()
Deprecated.Need to be implemented.int
size()
Get the number of nodes in this path.
-
Constructor Details
-
Path
Create an empty path corresponding to the given graph.- Parameters:
graph
- Graph containing the path.
-
Path
Create a new path containing a single node.- Parameters:
graph
- Graph containing the path.node
- Single node of the path.
-
Path
Create a new path with the given list of arcs.- Parameters:
graph
- Graph containing the path.arcs
- Arcs to construct the path.
-
-
Method Details
-
createFastestPathFromNodes
public static Path createFastestPathFromNodes(Graph graph, java.util.List<Node> nodes) throws java.lang.IllegalArgumentExceptionDeprecated.Need to be implemented.Create a new path that goes through the given list of nodes (in order), choosing the fastest route if multiple are available.- Parameters:
graph
- Graph containing the nodes in the list.nodes
- List of nodes to build the path.- Returns:
- A path that goes through the given list of nodes.
- Throws:
java.lang.IllegalArgumentException
- If the list of nodes is not valid, i.e. two consecutive nodes in the list are not connected in the graph.
-
createShortestPathFromNodes
public static Path createShortestPathFromNodes(Graph graph, java.util.List<Node> nodes) throws java.lang.IllegalArgumentExceptionDeprecated.Need to be implemented.Create a new path that goes through the given list of nodes (in order), choosing the shortest route if multiple are available.- Parameters:
graph
- Graph containing the nodes in the list.nodes
- List of nodes to build the path.- Returns:
- A path that goes through the given list of nodes.
- Throws:
java.lang.IllegalArgumentException
- If the list of nodes is not valid, i.e. two consecutive nodes in the list are not connected in the graph.
-
concatenate
Concatenate the given paths.- Parameters:
paths
- Array of paths to concatenate.- Returns:
- Concatenated path.
- Throws:
java.lang.IllegalArgumentException
- if the paths cannot be concatenated (IDs of map do not match, or the end of a path is not the beginning of the next).
-
getGraph
- Returns:
- Graph containing the path.
-
getOrigin
- Returns:
- First node of the path.
-
getDestination
- Returns:
- Last node of the path.
-
getArcs
- Returns:
- List of arcs in the path.
-
isEmpty
public boolean isEmpty()Check if this path is empty (it does not contain any node).- Returns:
- true if this path is empty, false otherwise.
-
size
public int size()Get the number of nodes in this path.- Returns:
- Number of nodes in this path.
-
isValid
public boolean isValid()Deprecated.Need to be implemented.Check if this path is valid. A path is valid if any of the following is true:- it is empty;
- it contains a single node (without arcs);
- the first arc has for origin the origin of the path and, for two consecutive arcs, the destination of the first one is the origin of the second one.
- Returns:
- true if the path is valid, false otherwise.
-
getLength
public float getLength()Deprecated.Need to be implemented.Compute the length of this path (in meters).- Returns:
- Total length of the path (in meters).
-
getTravelTime
public double getTravelTime(double speed)Deprecated.Need to be implemented.Compute the time required to travel this path if moving at the given speed.- Parameters:
speed
- Speed to compute the travel time.- Returns:
- Time (in seconds) required to travel this path at the given speed (in kilometers-per-hour).
-
getMinimumTravelTime
public double getMinimumTravelTime()Deprecated.Need to be implemented.Compute the time to travel this path if moving at the maximum allowed speed on every arc.- Returns:
- Minimum travel time to travel this path (in seconds).
-