Package org.goplanit.zoning
Class TransferZoneGroupImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.zoning.TransferZoneGroupImpl
-
- All Implemented Interfaces:
Cloneable
,Comparable<IdAble>
,Iterable<TransferZone>
,ExternalIdAble
,IdAble
,ManagedId
,TransferZoneGroup
public class TransferZoneGroupImpl extends ExternalIdAbleImpl implements TransferZoneGroup
A transfer zone group implementation. Practically this can be used to represent public transport stations for example- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected String
name
name of the transfer zone groupprotected Map<Long,TransferZone>
transferZoneMap
Map storing all the transfer zones in the group-
Fields inherited from interface org.goplanit.utils.zoning.TransferZoneGroup
TRANSFER_ZONE_GROUP_ID_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TransferZoneGroupImpl(IdGroupingToken tokenId)
ConstructorTransferZoneGroupImpl(TransferZoneGroupImpl transferZoneGroupImpl)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TransferZone
addTransferZone(TransferZone transferZone)
Add a transferZone and also register this group on this transfer zone at the same timeTransferZoneGroupImpl
clone()
Create a shallow copy of this entityprotected static long
generateTransferZoneGroupId(IdGroupingToken tokenId)
generate unique transfer zone group idString
getName()
Name of the groupCollection<TransferZone>
getTransferZones()
create a view of the registered transfer zones.boolean
hasTransferZone(TransferZone transferZone)
Verify if transfer zone is presentIterator<TransferZone>
iterator()
long
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idprotected void
recreateTransferZoneIdMapping()
recreate the mapping such that all the keys used for each transfer zone reflect their internal id.TransferZone
removeTransferZone(TransferZone transferZone)
remove a transfer zone from the group, and also remove the reference on the transfer zone at the same timevoid
setName(String name)
set Name of the groupint
size()
Number of registered transfer zones-
Methods inherited from class org.goplanit.utils.id.ExternalIdAbleImpl
getExternalId, getXmlId, setExternalId, setXmlId
-
Methods inherited from class org.goplanit.utils.id.IdAbleImpl
equals, generateAndSetId, generateId, getId, hashCode, setId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
getExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.zoning.TransferZoneGroup
getFirst, getIdClass, hasName, hasTransferZones, isEmpty
-
-
-
-
Field Detail
-
transferZoneMap
protected Map<Long,TransferZone> transferZoneMap
Map storing all the transfer zones in the group
-
name
protected String name
name of the transfer zone group
-
-
Constructor Detail
-
TransferZoneGroupImpl
protected TransferZoneGroupImpl(IdGroupingToken tokenId)
Constructor- Parameters:
tokenId
- to use
-
TransferZoneGroupImpl
public TransferZoneGroupImpl(TransferZoneGroupImpl transferZoneGroupImpl)
Copy constructor- Parameters:
transferZoneGroupImpl
- to copy
-
-
Method Detail
-
recreateTransferZoneIdMapping
protected void recreateTransferZoneIdMapping()
recreate the mapping such that all the keys used for each transfer zone reflect their internal id. To be called whenever the ids of transfer zones are changed
-
generateTransferZoneGroupId
protected static long generateTransferZoneGroupId(IdGroupingToken tokenId)
generate unique transfer zone group id- Parameters:
tokenId
- contiguous id generation within this group for instances of this class- Returns:
- odZoneId
-
iterator
public Iterator<TransferZone> iterator()
- Specified by:
iterator
in interfaceIterable<TransferZone>
-
getName
public String getName()
Name of the group- Specified by:
getName
in interfaceTransferZoneGroup
- Returns:
- name
-
setName
public void setName(String name)
set Name of the group- Specified by:
setName
in interfaceTransferZoneGroup
- Parameters:
name
- to set
-
addTransferZone
public TransferZone addTransferZone(TransferZone transferZone)
Add a transferZone and also register this group on this transfer zone at the same time- Specified by:
addTransferZone
in interfaceTransferZoneGroup
- Parameters:
transferZone
- to add- Returns:
- previousTransferZone under same id (if any)
-
removeTransferZone
public TransferZone removeTransferZone(TransferZone transferZone)
remove a transfer zone from the group, and also remove the reference on the transfer zone at the same time- Specified by:
removeTransferZone
in interfaceTransferZoneGroup
- Parameters:
transferZone
- to remove- Returns:
- removed transfer zone
-
hasTransferZone
public boolean hasTransferZone(TransferZone transferZone)
Verify if transfer zone is present- Specified by:
hasTransferZone
in interfaceTransferZoneGroup
- Parameters:
transferZone
- to check- Returns:
- true when present, false otherwise
-
size
public int size()
Number of registered transfer zones- Specified by:
size
in interfaceTransferZoneGroup
- Returns:
- number of registered transfer zones
-
getTransferZones
public Collection<TransferZone> getTransferZones()
create a view of the registered transfer zones. Any changes are reflected in the group as well- Specified by:
getTransferZones
in interfaceTransferZoneGroup
- Returns:
- registered transfer zones
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIds
in interfaceManagedId
- Parameters:
tokenId
- to use- Returns:
- the updated internal id
-
clone
public TransferZoneGroupImpl clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceIdAble
- Specified by:
clone
in interfaceTransferZoneGroup
- Overrides:
clone
in classExternalIdAbleImpl
- Returns:
- shallow copy of entity
-
-