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>connectoidMapconnectoids containerprotected IdGroupingTokenidTokenid generation token
-
Constructor Summary
Constructors Constructor Description ConnectoidsImpl(IdGroupingToken idToken)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connectoidget(long id)Get connectoid by idIterator<Connectoid>iterator()Connectoidregister(Connectoid connectoid)register a connectoid If new connectoid overrides an existing connectoid, the removed connectoid is returnedDirectedConnectoidregisterNew(LinkSegment accessLinkSegment)Create new connectoid for a physical access node and leave the connections for access zones for laterDirectedConnectoidregisterNew(LinkSegment accessLinkSegment, Zone parentZone)Create new connectoid for a zone and physical access edge segmentDirectedConnectoidregisterNew(LinkSegment accessLinkSegment, Zone parentZone, double length)Create new connectoid for a zone and physical access nodeUndirectedConnectoidregisterNew(Node accessNode)Create new connectoid for a physical access node and leave the connections for access zones for laterUndirectedConnectoidregisterNew(Node accessNode, Zone parentZone)Create new connectoid for a zone and physical access nodeUndirectedConnectoidregisterNew(Node accessNode, Zone parentZone, double length)Create new connectoid for a zone and physical access nodeintsize()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:
iteratorin 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:
registerin 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:
registerNewin 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:
registerNewin 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:
registerNewin 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:
registerNewin 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:
registerNewin 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:
registerNewin 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:
getin interfaceConnectoids- Parameters:
id- the id of this connectoid- Returns:
- the retrieved connectoid
-
size
public int size()
Return number of connectoids- Specified by:
sizein interfaceConnectoids- Returns:
- the number of connectoids
-
-