Package org.planit.zoning
Class ConnectoidsImpl
- java.lang.Object
-
- org.planit.zoning.ConnectoidsImpl
-
- All Implemented Interfaces:
Iterable<Connectoid>
,Connectoids
public class ConnectoidsImpl extends Object implements Connectoids
Implementation of Connectoids class- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Long,Connectoid>
connectoidMap
connectoids containerprotected IdGroupingToken
idToken
id generation token
-
Constructor Summary
Constructors Constructor Description ConnectoidsImpl(IdGroupingToken idToken)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connectoid
get(long id)
Get connectoid by idIterator<Connectoid>
iterator()
Connectoid
register(Connectoid connectoid)
register a connectoid If new connectoid overrides an existing connectoid, the removed connectoid is returnedDirectedConnectoid
registerNew(LinkSegment accessLinkSegment)
Create new connectoid for a physical access node and leave the connections for access zones for laterDirectedConnectoid
registerNew(LinkSegment accessLinkSegment, Zone parentZone)
Create new connectoid for a zone and physical access edge segmentDirectedConnectoid
registerNew(LinkSegment accessLinkSegment, Zone parentZone, double length)
Create new connectoid for a zone and physical access nodeUndirectedConnectoid
registerNew(Node accessNode)
Create new connectoid for a physical access node and leave the connections for access zones for laterUndirectedConnectoid
registerNew(Node accessNode, Zone parentZone)
Create new connectoid for a zone and physical access nodeUndirectedConnectoid
registerNew(Node accessNode, Zone parentZone, double length)
Create new connectoid for a zone and physical access nodeint
size()
Return number of connectoids-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
idToken
protected IdGroupingToken idToken
id generation token
-
connectoidMap
protected Map<Long,Connectoid> connectoidMap
connectoids container
-
-
Constructor Detail
-
ConnectoidsImpl
public ConnectoidsImpl(IdGroupingToken idToken)
Constructor- Parameters:
idToken
- to use
-
-
Method Detail
-
iterator
public Iterator<Connectoid> iterator()
- Specified by:
iterator
in interfaceIterable<Connectoid>
-
register
public Connectoid register(Connectoid connectoid)
register a connectoid If new connectoid overrides an existing connectoid, the removed connectoid is returned- Specified by:
register
in interfaceConnectoids
- Parameters:
connectoid
- the connectoid to be registered- Returns:
- connectoid added
-
registerNew
public UndirectedConnectoid registerNew(Node accessNode, Zone parentZone, double length) throws PlanItException
Create new connectoid for a zone and physical access node- Specified by:
registerNew
in interfaceConnectoids
- Parameters:
accessNode
- node providing access to network layerparentZone
- of the connectoidlength
- length of connectoid- Returns:
- registered connectoid
- Throws:
PlanItException
- thrown if error
-
registerNew
public UndirectedConnectoid registerNew(Node accessNode, Zone parentZone) throws PlanItException
Create new connectoid for a zone and physical access node- Specified by:
registerNew
in interfaceConnectoids
- Parameters:
accessNode
- node providing access to network layerparentZone
- of the connectoid- Returns:
- registered connectoid
- Throws:
PlanItException
- thrown if error
-
registerNew
public UndirectedConnectoid registerNew(Node accessNode) throws PlanItException
Create new connectoid for a physical access node and leave the connections for access zones for later- Specified by:
registerNew
in interfaceConnectoids
- Parameters:
accessNode
- node providing access to network layer- Returns:
- registered connectoid
- Throws:
PlanItException
- thrown if error
-
registerNew
public DirectedConnectoid registerNew(LinkSegment accessLinkSegment, Zone parentZone, double length) throws PlanItException
Create new connectoid for a zone and physical access node- Specified by:
registerNew
in interfaceConnectoids
- Parameters:
accessLinkSegment
- link segment providing access to network layerparentZone
- of the connectoidlength
- length of connectoid- Returns:
- registered connectoid
- Throws:
PlanItException
- thrown if error
-
registerNew
public DirectedConnectoid registerNew(LinkSegment accessLinkSegment, Zone parentZone) throws PlanItException
Create new connectoid for a zone and physical access edge segment- Specified by:
registerNew
in interfaceConnectoids
- Parameters:
accessLinkSegment
- link segment providing access to network layerparentZone
- of the connectoid- Returns:
- registered connectoid
- Throws:
PlanItException
- thrown if error
-
registerNew
public DirectedConnectoid registerNew(LinkSegment accessLinkSegment) throws PlanItException
Create new connectoid for a physical access node and leave the connections for access zones for later- Specified by:
registerNew
in interfaceConnectoids
- Parameters:
accessLinkSegment
- link segment providing access to network layer- Returns:
- registered connectoid
- Throws:
PlanItException
- thrown if error
-
get
public Connectoid get(long id)
Get connectoid by id- Specified by:
get
in interfaceConnectoids
- Parameters:
id
- the id of this connectoid- Returns:
- the retrieved connectoid
-
size
public int size()
Return number of connectoids- Specified by:
size
in interfaceConnectoids
- Returns:
- the number of connectoids
-
-