Class ModeFactoryImpl

    • Field Detail

      • modes

        protected final Modes modes
        modes container to use
    • Constructor Detail

      • ModeFactoryImpl

        protected ModeFactoryImpl​(IdGroupingToken groupId,
                                  Modes modes)
        Constructor
        Parameters:
        groupId - to use
        modes - 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 interface ModeFactory
        Parameters:
        groupId - the is generation token
        modeType - 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 interface ModeFactory
        Parameters:
        name - of the mode
        maxSpeed - maximum speed of the mode
        pcu - value for the mode
        physicalFeatures - the physical features of this custom mode
        usabilityFeatures - 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 interface ModeFactory
        Parameters:
        modeType - the predefined mode type
        Returns:
        new mode created, or existing mode when already present