Class FundamentalDiagramImpl
- java.lang.Object
-
- org.goplanit.supply.fundamentaldiagram.FundamentalDiagramImpl
-
- All Implemented Interfaces:
FundamentalDiagram
- Direct Known Subclasses:
NewellFundamentalDiagram
public abstract class FundamentalDiagramImpl extends Object implements FundamentalDiagram
Base class for fundamental diagram instances- Author:
- markr
-
-
Field Summary
-
Fields inherited from interface org.goplanit.supply.fundamentaldiagram.FundamentalDiagram
NEWELL
-
-
Constructor Summary
Constructors Constructor Description FundamentalDiagramImpl(FundamentalDiagramBranch freeFlowBranch, FundamentalDiagramBranch congestedBranch)
ConstructorFundamentalDiagramImpl(FundamentalDiagramImpl fundamentalDiagramImpl, boolean deepCopy)
Copy Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract FundamentalDiagram
deepClone()
deep clone of fundamental diagramFundamentalDiagramBranch
getCongestedBranch()
Congested branch of the FDFundamentalDiagramBranch
getFreeFlowBranch()
Free flow branch of the FDint
relaxedHashCode(int scale)
A fundamental diagram is based on a limited number of double variables to define it.abstract FundamentalDiagram
shallowClone()
Shallow copy of the fundamental diagram-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.supply.fundamentaldiagram.FundamentalDiagram
getCapacityFlowPcuHour, getMaximumDensityPcuKm, getMaximumSpeedKmHour, setCapacityPcuHour, setMaximumDensityPcuKmHour, setMaximumSpeedKmHour
-
-
-
-
Constructor Detail
-
FundamentalDiagramImpl
public FundamentalDiagramImpl(FundamentalDiagramBranch freeFlowBranch, FundamentalDiagramBranch congestedBranch)
Constructor- Parameters:
freeFlowBranch
- to usecongestedBranch
- to use
-
FundamentalDiagramImpl
public FundamentalDiagramImpl(FundamentalDiagramImpl fundamentalDiagramImpl, boolean deepCopy)
Copy Constructor- Parameters:
fundamentalDiagramImpl
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
getFreeFlowBranch
public FundamentalDiagramBranch getFreeFlowBranch()
Free flow branch of the FD- Specified by:
getFreeFlowBranch
in interfaceFundamentalDiagram
- Returns:
- free flow branch
-
getCongestedBranch
public FundamentalDiagramBranch getCongestedBranch()
Congested branch of the FD- Specified by:
getCongestedBranch
in interfaceFundamentalDiagram
- Returns:
- congested branch
-
relaxedHashCode
public int relaxedHashCode(int scale)
A fundamental diagram is based on a limited number of double variables to define it. In case we want to use the same FD for extremely similar variables we can use this relaxed hash code that ensures that for the given precision level identical hashes are created even if the underlying floating point variables differ beyond this precision.- Specified by:
relaxedHashCode
in interfaceFundamentalDiagram
- Parameters:
scale
- indicating how many decimals to consider, e.g., 2 considers 2 decimals for precision- Returns:
- created relaxed hash code
-
shallowClone
public abstract FundamentalDiagram shallowClone()
Shallow copy of the fundamental diagram- Specified by:
shallowClone
in interfaceFundamentalDiagram
- Returns:
- cloned instance
-
deepClone
public abstract FundamentalDiagram deepClone()
deep clone of fundamental diagram- Specified by:
deepClone
in interfaceFundamentalDiagram
- Returns:
- cloned instance
-
-