vanetsim.scenario.events
Class StartBlocking

java.lang.Object
  extended by vanetsim.scenario.events.Event
      extended by vanetsim.scenario.events.StartBlocking
All Implemented Interfaces:
java.lang.Comparable<Event>

public final class StartBlocking
extends Event

This class represents an event which starts blocking on a street.


Constructor Summary
StartBlocking(int time, int x, int y, int direction, int lanes)
          Constructor.
 
Method Summary
 int compareTo(Event other)
          Compare to another event.
 void destroy()
          Destroys itself.
 void execute()
          Execute the task.
 int getAffectedDirection()
          Gets the affected direction.
 int getAffectedLanes()
          Gets the amount of lanes (per direction) affected by this event.
 java.util.ArrayList<BlockingObject> getBlockingObjects()
          Gets the blocking objects.
 StopBlocking getStopBlockingEvent()
          Gets the event which ends this blocking.
 Street getStreet()
          Gets the street where blocking is done.
 java.lang.String getText()
          Returns a descriptive text for display in the GUI.
 int getX()
          Gets the x coordinate.
 int getY()
          Gets the y coordinate.
 void setStopBlockingEvent(StopBlocking event)
          Sets the event which ends this blocking.
 
Methods inherited from class vanetsim.scenario.events.Event
getTextColor, getTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StartBlocking

public StartBlocking(int time,
                     int x,
                     int y,
                     int direction,
                     int lanes)
              throws java.text.ParseException
Constructor.

Parameters:
time - the time in milliseconds when this event gets active
x - the x coordinate of this event
y - the y coordinate of this event
direction - The affected street direction. 0 for both directions, 1 for startNode to endNode, 1 for endNode to startNode
lanes - The amount of affected lanes (should be at least 1). Will be used for both directions. Use Integer.MAX_VALUE to use all lanes.
Throws:
java.text.ParseException - an exception indicating that creation wasn't successful
Method Detail

getText

public java.lang.String getText()
Returns a descriptive text for display in the GUI.

Specified by:
getText in class Event
Returns:
the text
See Also:
Event.getText()

compareTo

public int compareTo(Event other)
Compare to another event.

Parameters:
other - the other event
Returns:
-1 if other is larger, 1 if it's smaller and 0 if both are equal.
See Also:
Comparable.compareTo(java.lang.Object)

execute

public void execute()
Execute the task.

Specified by:
execute in class Event
See Also:
Event.execute()

destroy

public void destroy()
Destroys itself.

Specified by:
destroy in class Event
See Also:
Event.destroy()

getX

public int getX()
Gets the x coordinate.

Returns:
the x coordinate

getY

public int getY()
Gets the y coordinate.

Returns:
the y coordinate

getStopBlockingEvent

public StopBlocking getStopBlockingEvent()
Gets the event which ends this blocking.

Returns:
the event or null if this event exists forever

setStopBlockingEvent

public void setStopBlockingEvent(StopBlocking event)
Sets the event which ends this blocking.

Parameters:
event - the event which ends blocking

getStreet

public Street getStreet()
Gets the street where blocking is done.

Returns:
the street affected by this event

getAffectedDirection

public int getAffectedDirection()
Gets the affected direction.

Returns:
0 to indicate that this event is for both directions,1 that it's only from startNode to endNode, 1 that it's only from endNode to startNode

getBlockingObjects

public java.util.ArrayList<BlockingObject> getBlockingObjects()
Gets the blocking objects.

Returns:
the blocking objects

getAffectedLanes

public int getAffectedLanes()
Gets the amount of lanes (per direction) affected by this event.

Returns:
the amount of lanes