Package org.goplanit.zoning
Class Zoning
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<Zoning>
-
- org.goplanit.zoning.Zoning
-
- All Implemented Interfaces:
Serializable
,Comparable<IdAble>
,EventListener
,PlanitComponentListener
,EventListener
,ExternalIdAble
,IdAble
public class Zoning extends PlanitComponent<Zoning> implements Serializable
Zoning class which holds a particular zoning- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected org.opengis.referencing.crs.CoordinateReferenceSystem
crs
the CRS of this zoningprotected UndirectedConnectoids
odConnectoids
provide access to undirected connectoids (of od zones)protected OdZones
odZones
provide access to zonesprotected DirectedConnectoids
transferConnectoids
provide access to directed connectoids (of transfer zones)protected TransferZoneGroups
transferZoneGroups
provide access to transfer zone groups (if any)protected TransferZones
transferZones
provide access to transfer zones (if any)protected VirtualNetwork
virtualNetwork
Virtual network holds all the virtual connections to the physical network (layers) todo: we should have potentially multiple virtual networks per zoning, one for each physical network the zoning is used on!protected ZoningModifier
zoningModifier
modifier that can be used to perform modifications to the zoning that comprise more than a single element of the zoning, e.g.
-
Constructor Summary
Constructors Constructor Description Zoning(IdGroupingToken groupId, IdGroupingToken virtualNetworkGroupId)
Constructor The second id generation token should be the token used by the physical network to create physical network entities such as links, nodes, etc.Zoning(Zoning other, boolean deepCopy, ManagedIdDeepCopyMapper<UndirectedConnectoid> undirConnectoidMapper, ManagedIdDeepCopyMapper<DirectedConnectoid> dirConnectoidMapper, ManagedIdDeepCopyMapper<OdZone> odZoneMapper, ManagedIdDeepCopyMapper<TransferZone> transferZoneMapper, ManagedIdDeepCopyMapper<TransferZoneGroup> transferZoneGroupMapper)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
collectSettingsAsKeyValueMap()
Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entityZoning
deepClone()
deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possibleorg.opengis.referencing.crs.CoordinateReferenceSystem
getCoordinateReferenceSystem()
The crs used by the zoninglong
getNumberOfCentroids()
collect the number of centroids across all zones (od and transfer zones)long
getNumberOfConnectoids()
collect the number of connectoids (od and transfer)UndirectedConnectoids
getOdConnectoids()
Access to the origin-destination connectoids containerOdZones
getOdZones()
Access to the odZones containerDirectedConnectoids
getTransferConnectoids()
Access to the transfer connectoids containerTransferZoneGroups
getTransferZoneGroups()
Access to the transferZoneGroups containerTransferZones
getTransferZones()
Access to the transferZones containerVirtualNetwork
getVirtualNetwork()
Get the virtual network for this zoningZone
getZone(long id)
find a zone by over arching id regardless if it is a transfer or Od zoneZoningModifier
getZoningModifier()
The zoning's modifier instanceboolean
hasOdConnectoids()
Verify if transfer connectoids are presentboolean
hasOdZones()
Verify if od zones are presentboolean
hasTransferConnectoids()
Verify if transfer connectoids are presentboolean
hasTransferZones()
Verify if transfer zones are presentboolean
isCompatibleWithDemands(Demands demands, Modes modes)
Verify if passed in demands are compatible with the zoning structure.void
logInfo(String prefix)
Log general information on this zoning to the uservoid
reset()
All components should be able to reset going back to some representative initial statevoid
setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Set the crs to use by the zoningZoning
shallowClone()
Create a shallow copy of this entity-
Methods inherited from class org.goplanit.component.PlanitComponent
equals, getComponentType, getExternalId, getId, getIdGroupingToken, getKnownSupportedEventTypes, getXmlId, hashCode, onPlanitComponentEvent, setExternalId, setXmlId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
appendExternalId, appendExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, hasExternalId, hasXmlId, setXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
crs
protected org.opengis.referencing.crs.CoordinateReferenceSystem crs
the CRS of this zoning
-
virtualNetwork
protected final VirtualNetwork virtualNetwork
Virtual network holds all the virtual connections to the physical network (layers) todo: we should have potentially multiple virtual networks per zoning, one for each physical network the zoning is used on!
-
zoningModifier
protected final ZoningModifier zoningModifier
modifier that can be used to perform modifications to the zoning that comprise more than a single element of the zoning, e.g. updating of ids. It is also used by listeners that are needed to update the zoning components in case the referenced network gets modified
-
odConnectoids
protected final UndirectedConnectoids odConnectoids
provide access to undirected connectoids (of od zones)
-
transferConnectoids
protected final DirectedConnectoids transferConnectoids
provide access to directed connectoids (of transfer zones)
-
odZones
protected final OdZones odZones
provide access to zones
-
transferZones
protected final TransferZones transferZones
provide access to transfer zones (if any)
-
transferZoneGroups
protected final TransferZoneGroups transferZoneGroups
provide access to transfer zone groups (if any)
-
-
Constructor Detail
-
Zoning
public Zoning(IdGroupingToken groupId, IdGroupingToken virtualNetworkGroupId)
Constructor The second id generation token should be the token used by the physical network to create physical network entities such as links, nodes, etc. The virtual network should register connectoids, centroids, etc. with ids compatible under this same network. For example, a centroid is a vertex, like a node, so the vertex ids should be contiguous and unique throughout the combination of the virtual and physical network. Hence, they should use the same network id token- Parameters:
groupId
- contiguous id generation within this group for instances of this classvirtualNetworkGroupId
- contiguous id generation for all instances created by the virtual network
-
Zoning
public Zoning(Zoning other, boolean deepCopy, ManagedIdDeepCopyMapper<UndirectedConnectoid> undirConnectoidMapper, ManagedIdDeepCopyMapper<DirectedConnectoid> dirConnectoidMapper, ManagedIdDeepCopyMapper<OdZone> odZoneMapper, ManagedIdDeepCopyMapper<TransferZone> transferZoneMapper, ManagedIdDeepCopyMapper<TransferZoneGroup> transferZoneGroupMapper)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a deep copy, shallow copy otherwiseundirConnectoidMapper
- to use for tracking mapping between original and copied entity (may be null)dirConnectoidMapper
- to use for tracking mapping between original and copied entity (may be null)odZoneMapper
- to use for tracking mapping between original and copied entity (may be null)transferZoneMapper
- to use for tracking mapping between original and copied entity (may be null)transferZoneGroupMapper
- to use for tracking mapping between original and copied entity (may be null)
-
-
Method Detail
-
logInfo
public void logInfo(String prefix)
Log general information on this zoning to the user- Parameters:
prefix
- to use
-
getVirtualNetwork
public VirtualNetwork getVirtualNetwork()
Get the virtual network for this zoning- Returns:
- the virtual network for this zoning
-
isCompatibleWithDemands
public boolean isCompatibleWithDemands(Demands demands, Modes modes)
Verify if passed in demands are compatible with the zoning structure. Compatibility is ensured when the number of zones matches the number of origins/destinations in the demands.- Parameters:
demands
- to verify againstmodes
- to check- Returns:
- true when compatible, false otherwise
-
getZone
public Zone getZone(long id)
find a zone by over arching id regardless if it is a transfer or Od zone- Parameters:
id
- to find the zone by- Returns:
- zone found (if any)
-
getOdZones
public OdZones getOdZones()
Access to the odZones container- Returns:
- odZones
-
getTransferZones
public TransferZones getTransferZones()
Access to the transferZones container- Returns:
- transferZones
-
getTransferZoneGroups
public TransferZoneGroups getTransferZoneGroups()
Access to the transferZoneGroups container- Returns:
- TranferZoneGroups
-
getOdConnectoids
public UndirectedConnectoids getOdConnectoids()
Access to the origin-destination connectoids container- Returns:
- od connectoids container
-
getTransferConnectoids
public DirectedConnectoids getTransferConnectoids()
Access to the transfer connectoids container- Returns:
- transfer connectoids container
-
getNumberOfCentroids
public long getNumberOfCentroids()
collect the number of centroids across all zones (od and transfer zones)- Returns:
- total number of centroids
-
getNumberOfConnectoids
public long getNumberOfConnectoids()
collect the number of connectoids (od and transfer)- Returns:
- total number of connectoids
-
getZoningModifier
public ZoningModifier getZoningModifier()
The zoning's modifier instance- Returns:
- the zoning modifier
-
shallowClone
public Zoning shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in classPlanitComponent<Zoning>
- Returns:
- shallow copy of entity
-
deepClone
public Zoning deepClone()
deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possible- Specified by:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in classPlanitComponent<Zoning>
- Returns:
- deep copy of entity
-
reset
public void reset()
All components should be able to reset going back to some representative initial state- Specified by:
reset
in classPlanitComponent<Zoning>
-
collectSettingsAsKeyValueMap
public Map<String,String> collectSettingsAsKeyValueMap()
Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entity- Specified by:
collectSettingsAsKeyValueMap
in classPlanitComponent<Zoning>
- Returns:
- name-value map of all (user configurable) settings
-
hasOdZones
public boolean hasOdZones()
Verify if od zones are present- Returns:
- true when present, false otherwise
-
hasTransferZones
public boolean hasTransferZones()
Verify if transfer zones are present- Returns:
- true when present, false otherwise
-
hasTransferConnectoids
public boolean hasTransferConnectoids()
Verify if transfer connectoids are present- Returns:
- true when present, false otherwise
-
hasOdConnectoids
public boolean hasOdConnectoids()
Verify if transfer connectoids are present- Returns:
- true when present, false otherwise
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
The crs used by the zoning- Returns:
- crs
-
setCoordinateReferenceSystem
public void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Set the crs to use by the zoning- Parameters:
crs
- to use
-
-