Class UpdateConnectoidsOnVertexRemovalHandler
- java.lang.Object
-
- org.goplanit.zoning.modifier.event.handler.UpdateConnectoidsOnVertexRemovalHandler
-
- All Implemented Interfaces:
EventListener
,EventListener
,DirectedGraphModifierListener
,GraphModifierListener
public class UpdateConnectoidsOnVertexRemovalHandler extends Object implements DirectedGraphModifierListener
A listener designed to deal with the situation that sub graphs are removed from the network which leaves connectoids in the zoning that reference these sub graph elements invalid. This listener should be used to register on the DirectedGraphModifier before any call to GraphModifier.removeSubGraph in which case callbacks are triggered which allow this instance to update the connectoids, i.e., remove any affected connectoids that are no longer valid.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<DirectedVertex,ArrayList<Connectoid>>
connectoidsByAccessVertex
index all connectoids by access vertex to minimise lookupsprotected Zoning
zoning
zoning to update zoning components when needed
-
Constructor Summary
Constructors Constructor Description UpdateConnectoidsOnVertexRemovalHandler(Zoning zoning)
constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterSubGraphRemovalComplete()
finalise subgraph removal for the connectoids by recreating the connectoid idsEventType[]
getKnownSupportedEventTypes()
Collect explicitly supported event types that are known.protected void
initialiseIndices()
initialise indices usedvoid
onDirectedGraphModificationEvent(DirectedGraphModificationEvent event)
Notify method for directed graph modification eventsvoid
onGraphModificationEvent(GraphModificationEvent event)
Notify method for graph modification eventsprotected void
removeConnectoidsWithAccessVertex(Vertex vertex)
Remove connectoids for the given access vertex-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
-
-
-
Field Detail
-
zoning
protected final Zoning zoning
zoning to update zoning components when needed
-
connectoidsByAccessVertex
protected Map<DirectedVertex,ArrayList<Connectoid>> connectoidsByAccessVertex
index all connectoids by access vertex to minimise lookups
-
-
Constructor Detail
-
UpdateConnectoidsOnVertexRemovalHandler
public UpdateConnectoidsOnVertexRemovalHandler(Zoning zoning)
constructor- Parameters:
zoning
- to use
-
-
Method Detail
-
initialiseIndices
protected void initialiseIndices()
initialise indices used
-
removeConnectoidsWithAccessVertex
protected void removeConnectoidsWithAccessVertex(Vertex vertex)
Remove connectoids for the given access vertex- Parameters:
vertex
- to remove connectoids for
-
afterSubGraphRemovalComplete
protected void afterSubGraphRemovalComplete()
finalise subgraph removal for the connectoids by recreating the connectoid ids
-
getKnownSupportedEventTypes
public EventType[] getKnownSupportedEventTypes()
Collect explicitly supported event types that are known. When not defined the user has to explicitly provide them upon registering the listener on an event producer, otherwise they can be extracted from here- Specified by:
getKnownSupportedEventTypes
in interfaceEventListener
- Returns:
- the supported event types
-
onGraphModificationEvent
public void onGraphModificationEvent(GraphModificationEvent event)
Notify method for graph modification events- Specified by:
onGraphModificationEvent
in interfaceGraphModifierListener
- Parameters:
event
- representing the graph modification event at hand
-
onDirectedGraphModificationEvent
public void onDirectedGraphModificationEvent(DirectedGraphModificationEvent event)
Notify method for directed graph modification events- Specified by:
onDirectedGraphModificationEvent
in interfaceDirectedGraphModifierListener
- Parameters:
event
- representing the directed graph modification event at hand
-
-