Package org.planit.mode
Class ModesImpl
- java.lang.Object
-
- org.planit.mode.ModesImpl
-
-
Constructor Summary
Constructors Constructor Description ModesImpl(IdGroupingToken groupId)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsPredefinedMode(PredefinedModeType modeType)verify if predefined mode is registeredModeget(long id)Return a Mode by its idPredefinedModeget(PredefinedModeType modeType)get predefined mode if it is registeredModegetByXmlId(String xmlId)Retrieve a Mode by its xml Id This method is not efficient, since it loops through all the registered modes in order to find the required mode.ModegetFirst()Collect the first registered modeIterator<Mode>iterator()Iterator over available modesprotected Moderegister(Mode mode)Add mode to the internal containerPredefinedModeregisterNew(PredefinedModeType modeType)Create and register a new predefined mode.ModeregisterNewCustomMode(String name, double maxSpeed, double pcu, PhysicalModeFeatures physicalFeatures, UsabilityModeFeatures usabilityFeatures)Create and register new modeSet<Mode>setOf()Provide all modes as a set.intsize()Return number of registered modes-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ModesImpl
public ModesImpl(IdGroupingToken groupId)
Constructor- Parameters:
groupId- to generated id's within this group
-
-
Method Detail
-
register
protected Mode register(Mode mode)
Add mode to the internal container- Parameters:
mode- to be registered in this network- Returns:
- mode, in case it overrides an existing mode, the removed mode is returned
-
registerNewCustomMode
public Mode registerNewCustomMode(String name, double maxSpeed, double pcu, PhysicalModeFeatures physicalFeatures, UsabilityModeFeatures usabilityFeatures)
Create and register new mode- Specified by:
registerNewCustomModein interfaceModes- Parameters:
name- of the modemaxSpeed- maximum speed of the modepcu- value for the modephysicalFeatures- the physical features of this custom modeusabilityFeatures- the usability features of this custom mode- Returns:
- new mode created
-
registerNew
public PredefinedMode registerNew(PredefinedModeType modeType) throws PlanItException
Create and register a new predefined mode. When it already exists, the existing entry is returned- Specified by:
registerNewin interfaceModes- Parameters:
modeType- the predefined mode type- Returns:
- new mode created, or existing mode when already present
- Throws:
PlanItException- thrown if error
-
size
public int size()
Return number of registered modes
-
get
public Mode get(long id)
Return a Mode by its id
-
containsPredefinedMode
public boolean containsPredefinedMode(PredefinedModeType modeType)
verify if predefined mode is registered- Specified by:
containsPredefinedModein interfaceModes- Parameters:
modeType- to verify- Returns:
- true when available, false otherwise
-
get
public PredefinedMode get(PredefinedModeType modeType)
get predefined mode if it is registered
-
getFirst
public Mode getFirst()
Collect the first registered mode
-
getByXmlId
public Mode getByXmlId(String xmlId)
Retrieve a Mode by its xml Id This method is not efficient, since it loops through all the registered modes in order to find the required mode. The equivalent method in InputBuilderListener is more efficient and should be used in preference to this in Java code.- Specified by:
getByXmlIdin interfaceModes- Parameters:
xmlId- the XML Id of the specified mode- Returns:
- the retrieved mode, or null if no mode was found
-
-