Class ConnectoidImpl

    • Constructor Detail

      • ConnectoidImpl

        protected ConnectoidImpl​(IdGroupingToken idToken)
        Constructor
        Parameters:
        idToken - contiguous id generation within this group for instances of this class
      • ConnectoidImpl

        protected ConnectoidImpl​(IdGroupingToken idToken,
                                 Zone accessZone,
                                 double length)
        Constructor
        Parameters:
        idToken - contiguous id generation within this group for instances of this class
        accessZone - for the connectoid
        length - for the connection
      • ConnectoidImpl

        protected ConnectoidImpl​(IdGroupingToken idToken,
                                 Zone accessZone)
        Constructor
        Parameters:
        idToken - contiguous id generation within this group for instances of this class
        accessZone - for the connectoid
      • ConnectoidImpl

        protected ConnectoidImpl​(ConnectoidImpl connectoidImpl)
        Copy constructor
        Parameters:
        connectoidImpl - to copy
    • Method Detail

      • generateId

        protected static long generateId​(IdGroupingToken groupId)
        Generate connectoid id
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        Returns:
        id of connectoid
      • recreateAccessZoneIdMapping

        public void recreateAccessZoneIdMapping()
        recreate the id mapping for the registered access zones
      • setId

        protected void setId​(long id)
        set the connectoid id
        Overrides:
        setId in class IdAbleImpl
        Parameters:
        id - to set as unique internal id across all connectoids
      • setType

        public void setType​(ConnectoidType type)
        Set the type of the connectoid
        Specified by:
        setType in interface Connectoid
        Parameters:
        type - its type
      • setName

        public void setName​(String name)
        Set the name of the connectoid
        Specified by:
        setName in interface Connectoid
        Parameters:
        name - its name
      • getName

        public String getName()
        The name of the connectoid
        Specified by:
        getName in interface Connectoid
        Returns:
        its name
      • getAccessZones

        public Collection<Zone> getAccessZones()
        The zones that can be accessed by this connectoid
        Specified by:
        getAccessZones in interface Connectoid
        Returns:
        accessible zones
      • getFirstAccessZone

        public Zone getFirstAccessZone()
        first available zone that is accessible based on the first entry the iterator returns
        Specified by:
        getFirstAccessZone in interface Connectoid
        Returns:
        first available zone
      • getNumberOfAccessZones

        public long getNumberOfAccessZones()
        the number of accessible zones registered
        Specified by:
        getNumberOfAccessZones in interface Connectoid
        Returns:
        number of accessible zones
      • getLengthKm

        public Optional<Double> getLengthKm​(Zone accessZone)
        length can be used to virtually assign a length to the connectoid/zone combination
        Specified by:
        getLengthKm in interface Connectoid
        Parameters:
        accessZone - to collect length for
        Returns:
        length in km(null if zone is not registered)
      • addAccessZone

        public Zone addAccessZone​(Zone accessZone)
        Add an access zone with default properties
        Specified by:
        addAccessZone in interface Connectoid
        Parameters:
        accessZone - to register as accessible
        Returns:
        overwritten zone if any
      • isModeAllowed

        public boolean isModeAllowed​(Zone accessZone,
                                     Mode mode)
                              throws PlanItException
        Verify if a mode is allowed access to the zone via this connectoid
        Specified by:
        isModeAllowed in interface Connectoid
        Parameters:
        accessZone - to verify
        mode - to verify if allowed
        Returns:
        true when allowed, false otherwise
        Throws:
        PlanItException - thrown if provided zone is not valid
      • hasAccessZone

        public boolean hasAccessZone​(Zone accessZone)
        Check if zone is registered as access zone
        Specified by:
        hasAccessZone in interface Connectoid
        Parameters:
        accessZone - to verify
        Returns:
        true when registered, false otherwise
      • setLength

        public void setLength​(Zone accessZone,
                              double length)
        Add an access zone and provide length to this connectoid
        Specified by:
        setLength in interface Connectoid
        Parameters:
        accessZone - to set length for
        length - to traverse between connectoid and zone
      • addAllowedMode

        public void addAllowedMode​(Zone accessZone,
                                   Mode allowedMode)
        Add an allowed mode. We assume the zone is already registered as an access zone for this connectoid
        Specified by:
        addAllowedMode in interface Connectoid
        Parameters:
        accessZone - to add allowed mode to
        allowedMode - to add
      • getExplicitlyAllowedModes

        public Collection<Mode> getExplicitlyAllowedModes​(Zone accessZone)
        collect modes that are explicitly allowed for this zone (unmodifiable). Note that if no explicit allowed modes are present, all modes are implicitly allowed. When there exist explicitly allowed modes, any mdoes in the network not included in the explicitly allowed modes are regarded to not be allowed.
        Specified by:
        getExplicitlyAllowedModes in interface Connectoid
        Parameters:
        accessZone - to check
        Returns:
        the modes explicitly allowed for this zone, null if none
      • recreateManagedIds

        public long recreateManagedIds​(IdGroupingToken tokenId)
        recreate the internal id(s) and set them including the Idable id
        Specified by:
        recreateManagedIds in interface ManagedId
        Parameters:
        tokenId - to use
        Returns:
        the updated internal id