Interface Modes

  • All Superinterfaces:
    Iterable<Mode>
    All Known Implementing Classes:
    ModesImpl

    public interface Modes
    extends Iterable<Mode>
    container class and factory methods for modes with some
    Author:
    markr
    • Method Detail

      • registerNewCustomMode

        Mode registerNewCustomMode​(String name,
                                   double maxSpeed,
                                   double pcu,
                                   PhysicalModeFeatures physicalFeatures,
                                   UsabilityModeFeatures usabilityFeatures)
        Create and register new mode
        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

        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)