vanetsim.map
Class Node

java.lang.Object
  extended by vanetsim.map.Node

public final class Node
extends java.lang.Object

A node on the map.


Constructor Summary
Node(int x, int y)
          Instantiates a new node.
Node(int x, int y, boolean hasTrafficSignal)
          Instantiates a new node.
 
Method Summary
 void addCrossingStreet(Street street)
          Adds a crossing street.
 void addOutgoingStreet(Street street)
          Adds an outgoing street.
 void addSignalExceptionsOfString(java.lang.String arrayString)
          Fill Exception Array of a String.
 void calculateJunction()
          Calculates if this is a junction and the priorities of all possible ways which go over this junction.
 boolean delCrossingStreet(Street street)
          Removes a crossing street.
 boolean delOutgoingStreet(Street street)
          Removes an outgoing street.
 boolean equals(java.lang.Object other)
          Checks if this object is equal to another.
 Street[] getCrossingStreets()
          Gets an array of the streets which are crossing in this node.
 int getCrossingStreetsCount()
          Gets the number of streets crossing in this node.
 RSU getEncryptedRSU_()
           
 Junction getJunction()
          Returns the junction object associated with this node or null if this is not a junction.
static int getMaxNodeID()
          The maximum ID a node has.
 int getMixZoneRadius()
          The mixZoneRadius
 int getNodeID()
          Returns the unique ID of this node.
 Street[] getOutgoingStreets()
          Gets an array of the outgoing streets of this node.
 int getOutgoingStreetsCount()
          Gets the number of streets going out from this node.
 Region getRegion()
          Gets the region in which this node is found.
 java.lang.String getSignalExceptionsInString()
          Write exception array in one string.
 int[] getStreetHasException_()
           
 TrafficLight getTrafficLight_()
           
 int getX()
          Gets the x coordinate.
 int getY()
          Gets the y coordinate.
 int hashCode()
          Creates a hash code (needed for HashMaps or similar structures).
 boolean hasNonDefaultSettings()
          Check if a Traffic Signal has non-default settings
 boolean isHasTrafficSignal_()
           
static void resetNodeID()
          Resets the node ID counter so that newly created nodes begin with an ID of 0.
 void setEncryptedRSU_(RSU encryptedRSU_)
           
 void setHasTrafficSignal_(boolean hasTrafficSignal_)
           
 void setMixZoneRadius(int mixZoneRadius)
          Sets the mix zone radius
 void setRegion(Region region)
          Sets the region in which this node is found.
 void setStreetHasException_(int[] streetHasException_)
           
 void setTrafficLight_(TrafficLight trafficLight_)
           
 void setX(int x)
          Sets the x coordinate
 void setY(int y)
          Sets the y coordinate
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node(int x,
            int y)
Instantiates a new node.

Parameters:
x - the x coordinate
y - the y coordinate

Node

public Node(int x,
            int y,
            boolean hasTrafficSignal)
Instantiates a new node.

Parameters:
x - the x coordinate
y - the y coordinate
hasTrafficSignal - signals if node has a traffic signal
Method Detail

calculateJunction

public void calculateJunction()
Calculates if this is a junction and the priorities of all possible ways which go over this junction.


getJunction

public Junction getJunction()
Returns the junction object associated with this node or null if this is not a junction.

Returns:
the junction or null if this is not a junction

addOutgoingStreet

public void addOutgoingStreet(Street street)
Adds an outgoing street. If the array already contains the street, nothing is done. Note that this operation is not thread-safe.

Parameters:
street - The outgoing street to add.

delOutgoingStreet

public boolean delOutgoingStreet(Street street)
Removes an outgoing street. If the array doesn't contain the street, nothing is done. Note that this operation is not thread-safe.

Parameters:
street - The outgoing street to delete.
Returns:
true if street was removed, false if the street wasn't in the list

getOutgoingStreets

public Street[] getOutgoingStreets()
Gets an array of the outgoing streets of this node. You will always get an array (never null) but it might have zero size.

Returns:
the array

getOutgoingStreetsCount

public int getOutgoingStreetsCount()
Gets the number of streets going out from this node.

Returns:
the amount of streets

addCrossingStreet

public void addCrossingStreet(Street street)
Adds a crossing street. If the array already contains the street, nothing is done. Note that this operation is not thread-safe.

Parameters:
street - the crossing street to add.

delCrossingStreet

public boolean delCrossingStreet(Street street)
Removes a crossing street. If the array doesn't contain the street, nothing is done. Note that this operation is not thread-safe.

Parameters:
street - the incoming street to delete.
Returns:
true if street was removed, false if the street wasn't in the list

getCrossingStreets

public Street[] getCrossingStreets()
Gets an array of the streets which are crossing in this node. You will always get an array (never null) but it might have zero size.

Returns:
the array

getCrossingStreetsCount

public int getCrossingStreetsCount()
Gets the number of streets crossing in this node.

Returns:
the amount of streets

getX

public int getX()
Gets the x coordinate.

Returns:
the x coordinate

setX

public void setX(int x)
Sets the x coordinate

Parameters:
x - the new coordinate

getY

public int getY()
Gets the y coordinate.

Returns:
the y coordinate

setY

public void setY(int y)
Sets the y coordinate

Parameters:
y - the new coordinate

setRegion

public void setRegion(Region region)
Sets the region in which this node is found.

Parameters:
region - the region

getRegion

public Region getRegion()
Gets the region in which this node is found.

Returns:
the region

equals

public boolean equals(java.lang.Object other)
Checks if this object is equal to another.

Overrides:
equals in class java.lang.Object
Parameters:
other - the object to compare to
Returns:
true, if both are equal
See Also:
Object.equals(java.lang.Object)

getNodeID

public int getNodeID()
Returns the unique ID of this node.

Returns:
an integer

getMaxNodeID

public static int getMaxNodeID()
The maximum ID a node has.

Returns:
the maximum ID

resetNodeID

public static void resetNodeID()
Resets the node ID counter so that newly created nodes begin with an ID of 0.


hashCode

public int hashCode()
Creates a hash code (needed for HashMaps or similar structures).

Overrides:
hashCode in class java.lang.Object
Returns:
an Integer
See Also:
Object.hashCode()

setMixZoneRadius

public void setMixZoneRadius(int mixZoneRadius)
Sets the mix zone radius

Parameters:
mixZoneRadius - the new mix zone radius

getMixZoneRadius

public int getMixZoneRadius()
The mixZoneRadius

Returns:
the max zone radius

getEncryptedRSU_

public RSU getEncryptedRSU_()

setEncryptedRSU_

public void setEncryptedRSU_(RSU encryptedRSU_)

isHasTrafficSignal_

public boolean isHasTrafficSignal_()

setHasTrafficSignal_

public void setHasTrafficSignal_(boolean hasTrafficSignal_)

setTrafficLight_

public void setTrafficLight_(TrafficLight trafficLight_)
Parameters:
trafficLight_ - the trafficLight_ to set

getTrafficLight_

public TrafficLight getTrafficLight_()
Returns:
the trafficLight_

getStreetHasException_

public int[] getStreetHasException_()
Returns:
the streetHasException_

setStreetHasException_

public void setStreetHasException_(int[] streetHasException_)
Parameters:
streetHasException_ - the streetHasException_ to set

addSignalExceptionsOfString

public void addSignalExceptionsOfString(java.lang.String arrayString)
Fill Exception Array of a String.


hasNonDefaultSettings

public boolean hasNonDefaultSettings()
Check if a Traffic Signal has non-default settings

Returns:
true if settings are non-default

getSignalExceptionsInString

public java.lang.String getSignalExceptionsInString()
Write exception array in one string. Please check if Signal has exceptions before using.

Returns:
string with exceptions