Package org.planit.network.virtual
Class ConnectoidImpl
- java.lang.Object
-
- org.planit.graph.EdgeImpl
-
- org.planit.network.virtual.ConnectoidImpl
-
- All Implemented Interfaces:
Serializable
,Comparable<Edge>
,Edge
,Connectoid
public class ConnectoidImpl extends EdgeImpl implements Connectoid
connectoid connecting a zone to the physical road network, carrying two connectoid segments in one or two directions which may carry additional information for each particular direction of the connectoid.- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
connectoidId
unique internal identifierprotected Object
externalId
External Id of the connectoid-
Fields inherited from class org.planit.graph.EdgeImpl
edgeSegmentAB, edgeSegmentBA, id, inputProperties, length, name, vertexA, vertexB
-
Fields inherited from interface org.planit.utils.network.virtual.Connectoid
DEFAULT_LENGTH_KM
-
-
Constructor Summary
Constructors Constructor Description ConnectoidImpl(IdGroupingToken groupId, Centroid centroidA, Node nodeB, double length)
ConstructorConnectoidImpl(IdGroupingToken groupId, Centroid centroidA, Node nodeB, double length, Object externalId)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static int
generateConnectoidId(IdGroupingToken groupId)
Generate connectoid idlong
getConnectoidId()
Return the id of this connectoidObject
getExternalId()
Collect the external id of this connectoidboolean
hasExternalId()
Returns true if this connectoid has its external Id set, false otherwiseConnectoidSegment
registerConnectoidSegment(ConnectoidSegment connectoidSegment, boolean directionAB)
Register connectoidSegment.void
setExternalId(Object externalId)
set the external id of this connectoid-
Methods inherited from class org.planit.graph.EdgeImpl
addInputProperty, compareTo, generateEdgeId, getEdgeSegmentAB, getEdgeSegmentBA, getId, getInputProperty, getLength, getName, getVertexA, getVertexB, registerEdgeSegment, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.planit.utils.graph.Edge
addInputProperty, getEdgeSegmentAB, getEdgeSegmentBA, getId, getInputProperty, getLength, getName, getVertexA, getVertexB
-
-
-
-
Field Detail
-
connectoidId
protected final long connectoidId
unique internal identifier
-
externalId
protected Object externalId
External Id of the connectoid
-
-
Constructor Detail
-
ConnectoidImpl
public ConnectoidImpl(IdGroupingToken groupId, Centroid centroidA, Node nodeB, double length, Object externalId) throws PlanItException
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classcentroidA
- the centroid at one end of the connectoidnodeB
- the node at the other end of the connectoidlength
- length of the current connectoidexternalId
- externalId of the connectoid (can be null, in which case this has not be set in the input files)- Throws:
PlanItException
- thrown if there is an error
-
ConnectoidImpl
public ConnectoidImpl(IdGroupingToken groupId, Centroid centroidA, Node nodeB, double length) throws PlanItException
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this classcentroidA
- the centroid at one end of the connectoidnodeB
- the node at the other end of the connectoidlength
- length of the current connectoid- Throws:
PlanItException
- thrown if there is an error
-
-
Method Detail
-
generateConnectoidId
protected static int generateConnectoidId(IdGroupingToken groupId)
Generate connectoid id- Parameters:
groupId
- contiguous id generation within this group for instances of this class- Returns:
- id of connectoid
-
registerConnectoidSegment
public ConnectoidSegment registerConnectoidSegment(ConnectoidSegment connectoidSegment, boolean directionAB) throws PlanItException
Register connectoidSegment. If there already exists a connectoidSegment for that direction it is replaced and returned- Specified by:
registerConnectoidSegment
in interfaceConnectoid
- Parameters:
connectoidSegment
- connectoid segment to be registereddirectionAB
- direction of travel- Returns:
- replaced ConnectoidSegment
- Throws:
PlanItException
- thrown if there is an error
-
getConnectoidId
public long getConnectoidId()
Return the id of this connectoid- Specified by:
getConnectoidId
in interfaceConnectoid
- Returns:
- id of this connectoid
-
getExternalId
public Object getExternalId()
Description copied from interface:Connectoid
Collect the external id of this connectoid- Specified by:
getExternalId
in interfaceConnectoid
- Returns:
- external id
-
setExternalId
public void setExternalId(Object externalId)
Description copied from interface:Connectoid
set the external id of this connectoid- Specified by:
setExternalId
in interfaceConnectoid
- Parameters:
externalId
- the external id to set
-
hasExternalId
public boolean hasExternalId()
Description copied from interface:Connectoid
Returns true if this connectoid has its external Id set, false otherwise- Specified by:
hasExternalId
in interfaceConnectoid
- Returns:
- true if this connectoid has its external Id set, false otherwise
-
-