Package org.planit.zoning
Class ConnectoidImpl
- java.lang.Object
-
- org.planit.utils.id.ExternalIdAbleImpl
-
- org.planit.zoning.ConnectoidImpl
-
- All Implemented Interfaces:
Comparable<Idable>,Iterable<Zone>,ExternalIdable,Idable,Connectoid
- Direct Known Subclasses:
DirectedConnectoidImpl,UndirectedConnectoidImpl
public abstract class ConnectoidImpl extends ExternalIdAbleImpl implements Connectoid
connectoid connecting one or more (transfer/OD) zone(s) to the physical road network, the type of connectoid depends on the implementing class- Author:
- markr
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classConnectoidImpl.AccessZonePropertiesStores access properties for each zone
-
Field Summary
Fields Modifier and Type Field Description protected HashMap<Long,ConnectoidImpl.AccessZoneProperties>accessZonesthe zones and their properties accessible from this connectoidprotected Stringnamename of the connectoid if anyprotected ConnectoidTypetypethe type of connectoid to identify its purpose more easily-
Fields inherited from interface org.planit.utils.zoning.Connectoid
DEFAULT_CONNECTOID_TYPE, DEFAULT_LENGTH_KM
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConnectoidImpl(IdGroupingToken idToken)ConstructorprotectedConnectoidImpl(IdGroupingToken idToken, Zone accessZone, double length)ConstructorprotectedConnectoidImpl(ConnectoidImpl connectoidImpl)Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ZoneaddAccessZone(Zone accessZone)add an access zone with default propertiesvoidaddAllowedMode(Zone accessZone, Mode... allowedModes)add an allowed mode to the alreadyprotected static longgenerateConnectoidId(IdGroupingToken groupId)Generate connectoid idCollection<Zone>getAccessZones()the zones that can be accessed by this connectoidZonegetFirstAccessZone()first available zone that is accessible based on the first entry the iterator returnsDoublegetLength(Zone accessZone)length can be used to virtually assign a length to the connectoid/zone combinationStringgetName()The name of the connectoidlonggetNumberOfAccessZones()the number of accessible zones registeredConnectoidTypegetType()The type of the connectoidbooleanhasAccessZone(Zone accessZone)check if zone is registered as access zonebooleanisModeAllowed(Zone accessZone, Mode mode)Verify if a mode is allowed access to the zone via this connectoidIterator<Zone>iterator()voidsetLength(Zone accessZone, double length)add an access zone and provide length to this connectoidvoidsetName(String name)Set the name of the connectoidvoidsetType(ConnectoidType type)Set the type of the connectoid-
Methods inherited from class org.planit.utils.id.ExternalIdAbleImpl
getExternalId, getId, getXmlId, setExternalId, setId, setXmlId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.id.ExternalIdable
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
name
protected String name
name of the connectoid if any
-
type
protected ConnectoidType type
the type of connectoid to identify its purpose more easily
-
accessZones
protected final HashMap<Long,ConnectoidImpl.AccessZoneProperties> accessZones
the zones and their properties accessible from this connectoid
-
-
Constructor Detail
-
ConnectoidImpl
protected ConnectoidImpl(IdGroupingToken idToken)
Constructor- Parameters:
idToken- contiguous id generation within this group for instances of this class
-
ConnectoidImpl
protected ConnectoidImpl(ConnectoidImpl connectoidImpl)
Copy constructor- Parameters:
connectoidImpl- to copy
-
ConnectoidImpl
protected ConnectoidImpl(IdGroupingToken idToken, Zone accessZone, double length)
Constructor- Parameters:
idToken- contiguous id generation within this group for instances of this classaccessZone- for the connectoidlength- for the connection
-
-
Method Detail
-
generateConnectoidId
protected static long generateConnectoidId(IdGroupingToken groupId)
Generate connectoid id- Parameters:
groupId- contiguous id generation within this group for instances of this class- Returns:
- id of connectoid
-
setType
public void setType(ConnectoidType type)
Set the type of the connectoid- Specified by:
setTypein interfaceConnectoid- Parameters:
type- its type
-
getType
public ConnectoidType getType()
The type of the connectoid- Specified by:
getTypein interfaceConnectoid- Returns:
- its type
-
setName
public void setName(String name)
Set the name of the connectoid- Specified by:
setNamein interfaceConnectoid- Parameters:
name- its name
-
getName
public String getName()
The name of the connectoid- Specified by:
getNamein interfaceConnectoid- Returns:
- its name
-
getAccessZones
public Collection<Zone> getAccessZones()
the zones that can be accessed by this connectoid- Specified by:
getAccessZonesin interfaceConnectoid- Returns:
- accessible zones
-
getFirstAccessZone
public Zone getFirstAccessZone()
first available zone that is accessible based on the first entry the iterator returns- Specified by:
getFirstAccessZonein interfaceConnectoid- Returns:
- first available zone
-
getNumberOfAccessZones
public long getNumberOfAccessZones()
the number of accessible zones registered- Specified by:
getNumberOfAccessZonesin interfaceConnectoid- Returns:
- number of accessible zones
-
getLength
public Double getLength(Zone accessZone)
length can be used to virtually assign a length to the connectoid/zone combination- Specified by:
getLengthin interfaceConnectoid- Parameters:
accessZone- to collect length for- Returns:
- length (null if zone is not registered)
-
addAccessZone
public Zone addAccessZone(Zone accessZone)
add an access zone with default properties- Specified by:
addAccessZonein interfaceConnectoid- 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:
isModeAllowedin interfaceConnectoid- Parameters:
accessZone- to verifymode- 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:
hasAccessZonein interfaceConnectoid- 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:
setLengthin interfaceConnectoid- Parameters:
accessZone- to set length forlength- to traverse between connectoid and zone
-
addAllowedMode
public void addAllowedMode(Zone accessZone, Mode... allowedModes)
add an allowed mode to the already- Specified by:
addAllowedModein interfaceConnectoid- Parameters:
accessZone- to add allowed mode(s) toallowedModes- to add
-
-