Package org.goplanit.mode
Class ModeFactoryImpl
- java.lang.Object
-
- org.goplanit.utils.id.ManagedIdEntityFactoryImpl<Mode>
-
- org.goplanit.mode.ModeFactoryImpl
-
- All Implemented Interfaces:
ManagedIdEntityFactory<Mode>
,ModeFactory
public class ModeFactoryImpl extends ManagedIdEntityFactoryImpl<Mode> implements ModeFactory
Factory for creating modes on modes container- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Modes
modes
modes container to use-
Fields inherited from class org.goplanit.utils.id.ManagedIdEntityFactoryImpl
groupIdToken
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ModeFactoryImpl(IdGroupingToken groupId, Modes modes)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PredefinedMode
createPredefinedMode(IdGroupingToken groupId, PredefinedModeType modeType)
create a predefined mode instance without registering it on the container.PredefinedMode
registerNew(PredefinedModeType modeType)
Create and register a new predefined mode.Mode
registerNewCustomMode(String name, double maxSpeed, double pcu, PhysicalModeFeatures physicalFeatures, UsabilityModeFeatures usabilityFeatures)
Create and register new mode-
Methods inherited from class org.goplanit.utils.id.ManagedIdEntityFactoryImpl
createUniqueDeepCopyOf, createUniqueShallowCopyOf, getIdGroupingToken, setIdGroupingToken
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ManagedIdEntityFactory
createUniqueDeepCopyOf, createUniqueShallowCopyOf, getIdGroupingToken, setIdGroupingToken
-
-
-
-
Field Detail
-
modes
protected final Modes modes
modes container to use
-
-
Constructor Detail
-
ModeFactoryImpl
protected ModeFactoryImpl(IdGroupingToken groupId, Modes modes)
Constructor- Parameters:
groupId
- to usemodes
- to use
-
-
Method Detail
-
createPredefinedMode
public PredefinedMode createPredefinedMode(IdGroupingToken groupId, PredefinedModeType modeType)
create a predefined mode instance without registering it on the container. Use with caution as it can mess up the internal id structure if not registered subsequently- Specified by:
createPredefinedMode
in interfaceModeFactory
- Parameters:
groupId
- the is generation tokenmodeType
- predefined mode type to create- Returns:
- predefined mode instance
-
registerNewCustomMode
public Mode registerNewCustomMode(String name, double maxSpeed, double pcu, PhysicalModeFeatures physicalFeatures, UsabilityModeFeatures usabilityFeatures)
Create and register new mode- Specified by:
registerNewCustomMode
in interfaceModeFactory
- 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)
Create and register a new predefined mode. When it already exists, the existing entry is returned- Specified by:
registerNew
in interfaceModeFactory
- Parameters:
modeType
- the predefined mode type- Returns:
- new mode created, or existing mode when already present
-
-