Package org.planit.utils.mode
Interface Modes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancontains(Mode mode)Verify if mode is presentbooleancontainsPredefinedMode(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 IdModegetFirst()Collect the first registered modePredefinedModeregisterNew(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 interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
registerNewCustomMode
Mode registerNewCustomMode(String name, double maxSpeed, double pcu, PhysicalModeFeatures physicalFeatures, UsabilityModeFeatures usabilityFeatures)
Create and register new mode- 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
PredefinedMode registerNew(PredefinedModeType modeType) throws PlanItException
Create and register a new predefined mode. When it already exists, the existing entry is returned- Parameters:
modeType- the predefined mode type- Returns:
- new mode created, or existing mode when already present
- Throws:
PlanItException- thrown if error
-
size
int size()
Return number of registered modes- Returns:
- number of registered modes
-
get
Mode get(long id)
Return a Mode by its id- Parameters:
id- the id of the Mode- Returns:
- the specified mode
-
get
PredefinedMode get(PredefinedModeType modeType)
get predefined mode if it is registered- Parameters:
modeType- to collect- Returns:
- predefined mode when available, null otherwise
-
containsPredefinedMode
boolean containsPredefinedMode(PredefinedModeType modeType)
verify if predefined mode is registered- Parameters:
modeType- to verify- Returns:
- true when available, false otherwise
-
getFirst
Mode getFirst()
Collect the first registered mode- Returns:
- first registered mode if any
-
getByXmlId
Mode getByXmlId(String xmlId)
Retrieve a Mode by its XML Id- Parameters:
xmlId- the XML Id of the specified mode- Returns:
- the retrieved mode, or null if no mode was found
-
setOf
Set<Mode> setOf()
Provide all modes as a set. This collection is a copy so any changes have no impact on the internally registered modes- Returns:
- all registered modes
-
contains
default boolean contains(Mode mode)
Verify if mode is present- Parameters:
mode- to verify for- Returns:
- true when present, false otherwise (including when passed in mode is null)
-
-