Package org.insa.graphs.algorithm
Class AbstractInputData
- java.lang.Object
-
- org.insa.graphs.algorithm.AbstractInputData
-
- Direct Known Subclasses:
CarPoolingData,PackageSwitchData,ShortestPathData,WeaklyConnectedComponentsData
public abstract class AbstractInputData extends java.lang.ObjectBase class for algorithm input data classes. This class contains the basic data that are required by most graph algorithms, i.e. a graph, a mode (time / length) and a filter for the arc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractInputData.ModeEnum specifying the top mode of the algorithms.
-
Field Summary
Fields Modifier and Type Field Description protected ArcInspectorarcInspector
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractInputData(Graph graph, ArcInspector arcInspector)Create a new AbstractInputData instance for the given graph, mode and filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetCost(Arc arc)Retrieve the cost associated with the given arc according to the underlying arc inspector.GraphgetGraph()intgetMaximumSpeed()Retrieve the maximum speed associated with this input data, orGraphStatistics.NO_MAXIMUM_SPEEDif none is associated.AbstractInputData.ModegetMode()booleanisAllowed(Arc arc)Check if the given arc is allowed for the filter corresponding to this input.
-
-
-
Field Detail
-
arcInspector
protected final ArcInspector arcInspector
-
-
Constructor Detail
-
AbstractInputData
protected AbstractInputData(Graph graph, ArcInspector arcInspector)
Create a new AbstractInputData instance for the given graph, mode and filter.- Parameters:
graph- Graph for this input data.arcInspector- Arc inspector for this input data.
-
-
Method Detail
-
getGraph
public Graph getGraph()
- Returns:
- Graph associated with this input.
-
getCost
public double getCost(Arc arc)
Retrieve the cost associated with the given arc according to the underlying arc inspector.- Parameters:
arc- Arc for which cost should be retrieved.- Returns:
- Cost for the given arc.
- See Also:
ArcInspector
-
getMode
public AbstractInputData.Mode getMode()
- Returns:
- Mode associated with this input data.
- See Also:
AbstractInputData.Mode
-
getMaximumSpeed
public int getMaximumSpeed()
Retrieve the maximum speed associated with this input data, orGraphStatistics.NO_MAXIMUM_SPEEDif none is associated. The maximum speed associated with input data is different from the maximum speed associated with graph (accessible viaGraph.getGraphInformation()).- Returns:
- The maximum speed for this inspector, or
GraphStatistics.NO_MAXIMUM_SPEEDif none is set.
-
isAllowed
public boolean isAllowed(Arc arc)
Check if the given arc is allowed for the filter corresponding to this input.- Parameters:
arc- Arc to check.- Returns:
- true if the given arc is allowed.
- See Also:
ArcInspector
-
-