Package org.goplanit.zoning
Class TransferZoneImpl
- java.lang.Object
-
- org.goplanit.utils.id.IdAbleImpl
-
- org.goplanit.utils.id.ExternalIdAbleImpl
-
- org.goplanit.zoning.ZoneImpl
-
- org.goplanit.zoning.TransferZoneImpl
-
- All Implemented Interfaces:
Comparable<IdAble>
,ExternalIdAble
,IdAble
,ManagedId
,TransferZone
,Zone
public class TransferZoneImpl extends ZoneImpl implements TransferZone
A transfer zone- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.zoning.ZoneImpl
centroid, geometry, inputProperties, name
-
Fields inherited from interface org.goplanit.utils.zoning.TransferZone
DEFAULT_TYPE, TRANSFER_ZONE_ID_CLASS
-
Fields inherited from interface org.goplanit.utils.zoning.Zone
LOGGER, ZONE_ID_CLASS
-
-
Constructor Summary
Constructors Constructor Description TransferZoneImpl(IdGroupingToken tokenId)
constructorTransferZoneImpl(TransferZoneImpl other, boolean deepCopy)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToTransferZoneGroup(TransferZoneGroup transferZoneGroup)
register this transfer zone group as a group this transfer zone is part ofboolean
addTransferZonePlatformName(String platformName)
Add platform name for this transfer zoneTransferZoneImpl
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.protected static long
generateTransferZoneId(IdGroupingToken tokenId)
generate unique od zone idSet<TransferZoneGroup>
getTransferZoneGroups()
All transfer zone groups the transfer zone resides in (unmodifiable)long
getTransferZoneId()
In addition to a zone id across all zones of any derived type, each transfer zone also has a unique id across the transfer zones specificallyList<String>
getTransferZonePlatformNames()
Unmodifiable list of registered platform names for this transfer zone (if any).TransferZoneType
getTransferZoneType()
collect the type of this transfer zoneboolean
hasTransferZoneGroup()
Verify if a transfer zone is part of one or more transfer zone groupsboolean
isInTransferZoneGroup(TransferZoneGroup transferZoneGroup)
Verify if transfer zone is part of passed in transfer zone grouplong
recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable idvoid
removeFromAllTransferZoneGroups()
remove this transfer zone from all groups it is registered on (and also update the group referencesboolean
removeFromTransferZoneGroup(TransferZoneGroup transferZoneGroup)
remove from transfer zone group provided and also remove ths transfer zone from group providedboolean
removeTransferZonePlatformName(String platformName)
Remove a platform name if presentprotected void
setTransferZoneId(long transferZoneId)
Set transfer zone Idvoid
setType(TransferZoneType type)
set the type of this transfer zoneTransferZoneImpl
shallowClone()
Create a shallow copy of this entity-
Methods inherited from class org.goplanit.zoning.ZoneImpl
addInputProperty, generateZoneId, getCentroid, getGeometry, getInputProperty, getName, setCentroid, setGeometry, setId, setName, toString
-
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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, getXmlId, hasExternalId, hasXmlId, setExternalId, setXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, getId, idEquals, idHashCode
-
Methods inherited from interface org.goplanit.utils.id.ManagedId
resetChildManagedIdEntities
-
Methods inherited from interface org.goplanit.utils.zoning.TransferZone
addTransferZonePlatformNames, addTransferZonePlatformNames, getTransferZoneIdClass, hasPlatformNames
-
Methods inherited from interface org.goplanit.utils.zoning.Zone
addInputProperty, getCentroid, getEnvelope, getGeometry, getGeometry, getIdClass, getInputProperty, getName, hasCentroid, hasGeometry, hasInputProperty, hasName, setGeometry, setName
-
-
-
-
Constructor Detail
-
TransferZoneImpl
public TransferZoneImpl(IdGroupingToken tokenId)
constructor- Parameters:
tokenId
- for id generation
-
TransferZoneImpl
public TransferZoneImpl(TransferZoneImpl other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a eep copy, shallow copy otherwise
-
-
Method Detail
-
generateTransferZoneId
protected static long generateTransferZoneId(IdGroupingToken tokenId)
generate unique od zone id- Parameters:
tokenId
- contiguous id generation within this group for instances of this class- Returns:
- odZoneId
-
setTransferZoneId
protected void setTransferZoneId(long transferZoneId)
Set transfer zone Id- Parameters:
transferZoneId
- to set
-
getTransferZoneId
public long getTransferZoneId()
In addition to a zone id across all zones of any derived type, each transfer zone also has a unique id across the transfer zones specifically- Specified by:
getTransferZoneId
in interfaceTransferZone
- Returns:
- transfer zone specific id
-
getTransferZonePlatformNames
public List<String> getTransferZonePlatformNames()
Unmodifiable list of registered platform names for this transfer zone (if any).- Specified by:
getTransferZonePlatformNames
in interfaceTransferZone
- Returns:
- transfer zone platform names if any were registered
-
addTransferZonePlatformName
public boolean addTransferZonePlatformName(String platformName)
Add platform name for this transfer zone- Specified by:
addTransferZonePlatformName
in interfaceTransferZone
- Parameters:
platformName
- to add- Returns:
- true if newly added, false otherwise
-
removeTransferZonePlatformName
public boolean removeTransferZonePlatformName(String platformName)
Remove a platform name if present- Specified by:
removeTransferZonePlatformName
in interfaceTransferZone
- Parameters:
platformName
- to remove- Returns:
- true when removed, false otherwise
-
setType
public void setType(TransferZoneType type)
set the type of this transfer zone- Specified by:
setType
in interfaceTransferZone
- Parameters:
type
- to set
-
getTransferZoneType
public TransferZoneType getTransferZoneType()
collect the type of this transfer zone- Specified by:
getTransferZoneType
in interfaceTransferZone
- Returns:
- transfer zone type
-
hasTransferZoneGroup
public boolean hasTransferZoneGroup()
Verify if a transfer zone is part of one or more transfer zone groups- Specified by:
hasTransferZoneGroup
in interfaceTransferZone
- Returns:
- true when in transfer zone group, false otherwise
-
isInTransferZoneGroup
public boolean isInTransferZoneGroup(TransferZoneGroup transferZoneGroup)
Verify if transfer zone is part of passed in transfer zone group- Specified by:
isInTransferZoneGroup
in interfaceTransferZone
- Parameters:
transferZoneGroup
- to check- Returns:
- true when part of group, false otherwise
-
addToTransferZoneGroup
public void addToTransferZoneGroup(TransferZoneGroup transferZoneGroup)
register this transfer zone group as a group this transfer zone is part of- Specified by:
addToTransferZoneGroup
in interfaceTransferZone
- Parameters:
transferZoneGroup
- to register as being part of
-
removeFromTransferZoneGroup
public boolean removeFromTransferZoneGroup(TransferZoneGroup transferZoneGroup)
remove from transfer zone group provided and also remove ths transfer zone from group provided- Specified by:
removeFromTransferZoneGroup
in interfaceTransferZone
- Parameters:
transferZoneGroup
- to remove ourselves as member from- Returns:
- true when removal was successful, false otherwise
-
removeFromAllTransferZoneGroups
public void removeFromAllTransferZoneGroups()
remove this transfer zone from all groups it is registered on (and also update the group references- Specified by:
removeFromAllTransferZoneGroups
in interfaceTransferZone
-
getTransferZoneGroups
public final Set<TransferZoneGroup> getTransferZoneGroups()
All transfer zone groups the transfer zone resides in (unmodifiable)- Specified by:
getTransferZoneGroups
in interfaceTransferZone
- Returns:
- transfer zone groups of the transfer zone
-
recreateManagedIds
public long recreateManagedIds(IdGroupingToken tokenId)
recreate the internal id(s) and set them including the Idable id- Specified by:
recreateManagedIds
in interfaceManagedId
- Overrides:
recreateManagedIds
in classZoneImpl
- Parameters:
tokenId
- to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))- Returns:
- the updated internal id
-
shallowClone
public TransferZoneImpl shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in interfaceTransferZone
- Specified by:
shallowClone
in interfaceZone
- Specified by:
shallowClone
in classZoneImpl
- Returns:
- shallow copy of entity
-
deepClone
public TransferZoneImpl deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code
-
-