Class LongAgentGraphArcImpl
java.lang.Object
com.amalgamasimulation.graphagent.AgentGraphArcImpl
com.amalgamasimulation.graphagent.LongAgentGraphArcImpl
- All Implemented Interfaces:
AgentGraphArc,GeometricGraphArc,LongAgentGraphArc
- Direct Known Subclasses:
RailArc
Simple implementation of
LongAgentGraphArc interface that is suitable
in most simple cases. Contains the generic implementations of all methods of
LongAgentGraphArc interface- Author:
- Andrey Korotin
-
Constructor Summary
ConstructorsConstructorDescriptionLongAgentGraphArcImpl(Polyline polyline) Creates a new instance ofLongAgentGraphArcImplwith the specifiedPolyline.LongAgentGraphArcImpl(Polyline polyline, LongAgentGraphArcImpl reverseArc) Creates a new instance ofLongAgentGraphArcImplwith the specifiedPolylineand reverse arc. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOccupyingAgent(LongAgent<? extends LongAgentGraphNode, ? extends LongAgentGraphArc> longAgent) Adds the specified agent to collection of occupying agents (used to prevent the overlay of agents), e.g.Returns an unmodifiable list of occupying agents that are currently occupying this arc.getOccupyingAgents(boolean includingReverse) Returns an unmodifiable list of occupying agents that are currently occupying this arc or this arc and reverse.Returns the arc that is a reverse to this one, ornullif this is a one-way arc.voidremoveAllOccurrencesOccupyingAgent(LongAgent<? extends LongAgentGraphNode, ? extends LongAgentGraphArc> longAgent) Removes the all Occurrences of specified agent from collection of occupying agents (used to prevent the overlay of agents), e.g.voidremoveOccupyingAgent(LongAgent<? extends LongAgentGraphNode, ? extends LongAgentGraphArc> longAgent) Removes the specified agent from collection of occupying agents (used to prevent the overlay of agents), e.g.voidsetReverseArc(GeometricGraphArc reverseArc) Sets the reverse arc to this one.Methods inherited from class com.amalgamasimulation.graphagent.AgentGraphArcImpl
addAgent, addCallbackPosition, afterAgentEntered, beforeAgentExited, clearCallbackPositions, containsAgent, getAgents, getCallbackPositions, getPolyline, getReverseArc, getReverseOffset, onAgentReachedPosition, onAgentVelocityChanged, recalculateAgents, removeAgent, removeCallbackPosition, setPolyline, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.amalgamasimulation.graphagent.AgentGraphArc
addAgent, addCallbackPosition, afterAgentEntered, beforeAgentExited, clearCallbackPositions, containsAgent, getAgents, getCallbackPositions, getReverseArc, onAgentReachedPosition, onAgentVelocityChanged, recalculateAgents, removeAgent, removeCallbackPositionMethods inherited from interface com.amalgamasimulation.graphagent.GeometricGraphArc
getLength, getPolyline, getReverseOffset
-
Constructor Details
-
LongAgentGraphArcImpl
Creates a new instance ofLongAgentGraphArcImplwith the specifiedPolyline.- Parameters:
polyline- specified polyline
-
LongAgentGraphArcImpl
Creates a new instance ofLongAgentGraphArcImplwith the specifiedPolylineand reverse arc.- Parameters:
polyline- specified polylinereverseArc- specified reverse arc (must implements LongAgentGraphArc)
-
-
Method Details
-
getReverseLongAgentArc
Description copied from interface:LongAgentGraphArcReturns the arc that is a reverse to this one, ornullif this is a one-way arc.- Specified by:
getReverseLongAgentArcin interfaceLongAgentGraphArc- Returns:
- reverse arc, or
null
-
setReverseArc
Sets the reverse arc to this one. Normally used only when constructing the graph.- Specified by:
setReverseArcin interfaceGeometricGraphArc- Overrides:
setReverseArcin classAgentGraphArcImpl- Parameters:
reverseArc- reverse arc to this one (must implements LongAgentGraphArc)- See Also:
-
addOccupyingAgent
public void addOccupyingAgent(LongAgent<? extends LongAgentGraphNode, ? extends LongAgentGraphArc> longAgent) Description copied from interface:LongAgentGraphArcAdds the specified agent to collection of occupying agents (used to prevent the overlay of agents), e.g. when the agent enters this arc or jumps to it.- Specified by:
addOccupyingAgentin interfaceLongAgentGraphArc- Parameters:
longAgent- agent being added
-
removeOccupyingAgent
public void removeOccupyingAgent(LongAgent<? extends LongAgentGraphNode, ? extends LongAgentGraphArc> longAgent) Description copied from interface:LongAgentGraphArcRemoves the specified agent from collection of occupying agents (used to prevent the overlay of agents), e.g. when the agent leaves this arc or is completely removed from graph environment.- Specified by:
removeOccupyingAgentin interfaceLongAgentGraphArc- Parameters:
longAgent- agent being removed
-
removeAllOccurrencesOccupyingAgent
public void removeAllOccurrencesOccupyingAgent(LongAgent<? extends LongAgentGraphNode, ? extends LongAgentGraphArc> longAgent) Description copied from interface:LongAgentGraphArcRemoves the all Occurrences of specified agent from collection of occupying agents (used to prevent the overlay of agents), e.g. when the agent leaves this arc or is completely removed from graph environment.- Specified by:
removeAllOccurrencesOccupyingAgentin interfaceLongAgentGraphArc- Parameters:
longAgent- agent being removed
-
getOccupyingAgents
Description copied from interface:LongAgentGraphArcReturns an unmodifiable list of occupying agents that are currently occupying this arc.- Specified by:
getOccupyingAgentsin interfaceLongAgentGraphArc- Returns:
- unmodifiable list of occupying agents that are currently occupying this arc
-
getOccupyingAgents
Description copied from interface:LongAgentGraphArcReturns an unmodifiable list of occupying agents that are currently occupying this arc or this arc and reverse.- Specified by:
getOccupyingAgentsin interfaceLongAgentGraphArc- Parameters:
includingReverse- should include agents on the reverse arch- Returns:
- unmodifiable list of occupying agents that are currently occupying this arc
-