Package org.goplanit.utils.zoning
Interface Connectoid
-
- All Superinterfaces:
Cloneable
,Comparable<IdAble>
,ExternalIdAble
,IdAble
,Iterable<Zone>
,ManagedId
- All Known Subinterfaces:
DirectedConnectoid
,UndirectedConnectoid
- All Known Implementing Classes:
ConnectoidImpl
,DirectedConnectoidImpl
,UndirectedConnectoidImpl
public interface Connectoid extends ExternalIdAble, ManagedId, Iterable<Zone>
the connecting component between zone(s) and the network. Note that connectoids are not vertices, they merely refer to physical entities via derived interfaces and the physical network.Each combintation of (zone,connectoid) can have additional properties such as length or allowed modes. Not specifying thos will cause the use of defaults (DEFAULT_LENGTH_KM, all modes allowed)
- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static Class<Connectoid>
CONNECTOID_ID_CLASS
the class ot use for id generationstatic ConnectoidType
DEFAULT_CONNECTOID_TYPE
default type is set to nonestatic double
DEFAULT_LENGTH_KM
Default connectoid length in km
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Zone
addAccessZone(Zone zone)
Add an access zone with default propertiesvoid
addAllowedMode(Zone zone, Mode allowedMode)
Add an allowed mode.default void
addAllowedModes(TransferZone transferZone, Set<Mode> allowedModes)
Add allowed modes.default void
addAllowedModes(Zone zone, Mode... allowedModes)
Add allowed modes.DirectedVertex
getAccessVertex()
collect the access vertex for this connectoidCollection<Zone>
getAccessZones()
The zones that can be accessed by this connectoidCollection<Mode>
getExplicitlyAllowedModes(Zone accessZone)
collect modes that are explicitly allowed for this zone (unmodifiable).Zone
getFirstAccessZone()
first available zone that is accessible based on the first entry the iterator returnsdefault Class<Connectoid>
getIdClass()
Each managed id class is expected to generate its ids based on its class signature.Optional<Double>
getLengthKm(Zone accessZone)
length can be used to virtually assign a length to the connectoid/zone combinationString
getName()
The name of the connectoidlong
getNumberOfAccessZones()
the number of accessible zones registeredConnectoidType
getType()
The type of the connectoidboolean
hasAccessZone(Zone accessZone)
Check if zone is registered as access zonedefault boolean
hasAccessZones()
Verify if access zones are registereddefault boolean
hasExplicitlyAllowedModes(Zone accessZone)
Verify if any modes are allowed for this zonedefault boolean
hasLength(Zone accessZone)
Verify if a length has been specified for the access zone to connectoid combinationdefault boolean
hasName()
Verify if the connectoid has a namedefault boolean
isAllModesAllowed(Zone accessZone)
Verify if all modes are allowed for this zoneboolean
isModeAllowed(Zone accessZone, Mode mode)
Verify if a mode is allowed access to the zone via this connectoidvoid
setLength(Zone zone, double length)
Add an access zone and provide length to this connectoidvoid
setName(String name)
Set the name of the connectoidvoid
setType(ConnectoidType type)
Set the type of the connectoid-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
clone, compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
recreateManagedIds, resetChildManagedIdEntities
-
-
-
-
Field Detail
-
CONNECTOID_ID_CLASS
static final Class<Connectoid> CONNECTOID_ID_CLASS
the class ot use for id generation
-
DEFAULT_LENGTH_KM
static final double DEFAULT_LENGTH_KM
Default connectoid length in km- See Also:
- Constant Field Values
-
DEFAULT_CONNECTOID_TYPE
static final ConnectoidType DEFAULT_CONNECTOID_TYPE
default type is set to none
-
-
Method Detail
-
setName
void setName(String name)
Set the name of the connectoid- Parameters:
name
- its name
-
getName
String getName()
The name of the connectoid- Returns:
- its name
-
setType
void setType(ConnectoidType type)
Set the type of the connectoid- Parameters:
type
- its type
-
getType
ConnectoidType getType()
The type of the connectoid- Returns:
- its type
-
getAccessZones
Collection<Zone> getAccessZones()
The zones that can be accessed by this connectoid- Returns:
- accessible zones
-
setLength
void setLength(Zone zone, double length)
Add an access zone and provide length to this connectoid- Parameters:
zone
- to set length forlength
- to traverse between connectoid and zone
-
addAllowedMode
void addAllowedMode(Zone zone, Mode allowedMode)
Add an allowed mode. We assume the zone is already registered as an access zone for this connectoid- Parameters:
zone
- to add allowed mode toallowedMode
- to add
-
addAccessZone
Zone addAccessZone(Zone zone)
Add an access zone with default properties- Parameters:
zone
- to register as accessible- Returns:
- overwritten zone if any
-
hasAccessZone
boolean hasAccessZone(Zone accessZone)
Check if zone is registered as access zone- Parameters:
accessZone
- to verify- Returns:
- true when registered, false otherwise
-
getFirstAccessZone
Zone getFirstAccessZone()
first available zone that is accessible based on the first entry the iterator returns- Returns:
- first available zone
-
getNumberOfAccessZones
long getNumberOfAccessZones()
the number of accessible zones registered- Returns:
- number of accessible zones
-
getLengthKm
Optional<Double> getLengthKm(Zone accessZone) throws PlanItException
length can be used to virtually assign a length to the connectoid/zone combination- Parameters:
accessZone
- to collect length for- Returns:
- length in km(null if zone is not registered)
- Throws:
PlanItException
- thrown if error
-
isModeAllowed
boolean isModeAllowed(Zone accessZone, Mode mode) throws PlanItException
Verify if a mode is allowed access to the zone via this connectoid- Parameters:
accessZone
- to verifymode
- to verify if allowed- Returns:
- true when allowed, false otherwise
- Throws:
PlanItException
- thrown if provided zone is not valid
-
getExplicitlyAllowedModes
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.- Parameters:
accessZone
- to check- Returns:
- the modes explicitly allowed for this zone, null if none
-
getAccessVertex
DirectedVertex getAccessVertex()
collect the access vertex for this connectoid- Returns:
- access vertex
-
getIdClass
default Class<Connectoid> getIdClass()
Each managed id class is expected to generate its ids based on its class signature. To be able to generate the correct id the class used for id generation is to be provided via this method call.- Specified by:
getIdClass
in interfaceManagedId
- Returns:
- idClass to use for generating ids for instances of this idable derived class
-
hasName
default boolean hasName()
Verify if the connectoid has a name- Returns:
- true when present false otherwise
-
addAllowedModes
default void addAllowedModes(Zone zone, Mode... allowedModes)
Add allowed modes. We assume the zone is already registered as an access zone for this connectoid- Parameters:
zone
- to add allowed mode(s) toallowedModes
- to add
-
addAllowedModes
default void addAllowedModes(TransferZone transferZone, Set<Mode> allowedModes)
Add allowed modes. We assume the zone is already registered as an access zone for this connectoid- Parameters:
transferZone
- to add allowed mode(s) toallowedModes
- to add
-
hasExplicitlyAllowedModes
default boolean hasExplicitlyAllowedModes(Zone accessZone)
Verify if any modes are allowed for this zone- Parameters:
accessZone
- to check- Returns:
- true when at least one mode is allowed, false otherwise
-
isAllModesAllowed
default boolean isAllModesAllowed(Zone accessZone)
Verify if all modes are allowed for this zone- Parameters:
accessZone
- to check- Returns:
- true when we know for certain all modes are allowed, false otherwise
-
hasLength
default boolean hasLength(Zone accessZone)
Verify if a length has been specified for the access zone to connectoid combination- Parameters:
accessZone
- to verify- Returns:
- true if present, false otherwise
-
hasAccessZones
default boolean hasAccessZones()
Verify if access zones are registered- Returns:
- true when present, false otherwise
-
-