|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.architecture.traffic.infrastructure.Node
public abstract class Node
Basic node
| Nested Class Summary | |
|---|---|
class |
Node.NodeStatistics
Basic node statistics. |
| Field Summary | |
|---|---|
static int |
C_DOWN
DOCUMENT ME! |
static int |
C_LEFT
DOCUMENT ME! |
static int |
C_RIGHT
DOCUMENT ME! |
static int |
C_UP
DOCUMENT ME! |
protected java.awt.Point |
coord
The coordinates of this node in pixels |
static int |
D_AHEAD
DOCUMENT ME! |
static int |
D_BACK
DOCUMENT ME! |
static int |
D_LEFT
DOCUMENT ME! |
static int |
D_RIGHT
DOCUMENT ME! |
static int |
EDGE
Constant for Node type EdgeNode. |
protected Drivelane[] |
inboundLanes
Caches for inbound and outbound lanes |
static int |
JUNCTION
Constant for Node type Junction (normal Node with traffic lights). |
static int |
NET_TUNNEL
Constant for Node type NetTunnel. |
protected int |
nodeId
The Id of this node |
static int |
NON_TL
Constant for Node type NoTLJunction (Node without traffic lights). |
protected Drivelane[] |
outboundLanes
Caches for inbound and outbound lanes |
protected java.lang.String |
parentName
DOCUMENT ME! |
protected SPData |
spdata
Shortest path data |
static int |
STAT_NUM_DATA
The number of roadusers delay tables are maintained of. |
protected Node.NodeStatistics[] |
statistics
All statistics of this Node. |
| Constructor Summary | |
|---|---|
protected |
Node()
Creates a new Node object. |
protected |
Node(java.awt.Point c)
Creates a new Node object. |
| Method Summary | |
|---|---|
abstract void |
addRoad(Road r,
int pos)
Adds a road at a connection-position. |
void |
addShortestPath(Drivelane lane,
int nodeId,
int ruType,
int length)
Adds shortest path for an exitnode |
boolean |
areAllTailsFree()
Returns whether or not all the Tails of all the outbound lanes of this Node are free or not |
protected abstract int |
calcDelay(Roaduser ru,
int cycle,
int distance)
Calculates the delay that has to be logged for this Node. |
boolean |
canCreateInstance(java.lang.Class request)
DOCUMENT ME! |
java.lang.Object |
createInstance(java.lang.Class request)
DOCUMENT ME! |
abstract Drivelane[] |
getAllLanes()
Returns an array of all lanes on this node |
abstract Road[] |
getAllRoads()
Returns all roads connected to this node. |
abstract Road[] |
getAlphaRoads()
Returns the alpha roads connected to this node |
java.awt.Rectangle |
getBounds()
Returns the bounding box of this Selectable |
java.awt.Point |
getCenterPoint()
DOCUMENT ME! |
java.util.Enumeration |
getChildren()
DOCUMENT ME! |
java.awt.Shape |
getComplexBounds()
DOCUMENT ME! |
java.awt.Point |
getCoord()
Returns the view coordinates of this node |
abstract int |
getDesiredSignType()
Returns the desired type of signs to add to inbound lanes on this node. |
static int |
getDirection(int src,
int dest)
Calculates the direction from one road to another. |
int |
getDistance(java.awt.Point p)
DOCUMENT ME! |
int |
getId()
Returns the Id of this node |
abstract Drivelane[] |
getInboundLanes()
Returns an array of all inbound lanes on this node |
abstract Drivelane[] |
getLanesLeadingFrom(Drivelane lane,
int ruType)
Returns an array of all outbound lanes supporting roadusers of given type that can be reached from the given inbound lane. |
abstract Drivelane[] |
getLanesLeadingTo(Drivelane lane,
int ruType)
Returns an array of all inbound lanes supporting roadusers of given type that lead to the given outbound lane. |
abstract java.lang.String |
getName()
Returns the name of this node. |
abstract int |
getNumAllLanes()
Returns the total number of lanes on this node |
abstract int |
getNumAlphaRoads()
Returns the number of alpha roads of this node |
abstract int |
getNumInboundLanes()
Returns the number of inbound lanes on this node |
abstract int |
getNumOutboundLanes()
Returns the number of outbound lanes on this node |
abstract int |
getNumRealSigns()
Returns the number of signs with a type ! |
abstract int |
getNumRoads()
Returns the number of roads connected to this node |
abstract int |
getNumSigns()
Returns the total number of signs on this node |
int |
getNumSkip(int direction,
int laneNumber)
Calculates the number of positions a roaduser can skip in the tail of its destination lane |
abstract Drivelane[] |
getOutboundLanes()
Returns an array of all outbound lanes on this node |
java.awt.Point |
getSelectionPoint()
DOCUMENT ME! |
java.awt.Point[] |
getSelectionPoints()
DOCUMENT ME! |
int[] |
getShortestPathDestinations(int ruType)
Returns all the exitnode ids this Node has shortestpath data to |
Drivelane[] |
getShortestPaths(int nodeID,
int ruType)
Returns shortest paths for exitnode and Roaduser type |
Node.NodeStatistics[] |
getStatistics()
Returns the statistics for all types of roadusers. |
Node.NodeStatistics |
getStatistics(int ruType)
Returns the statistics for the given roaduser type. |
abstract int |
getType()
Returns the type of this node |
abstract int |
getWidth()
Returns the width of this node in number of lanes |
boolean |
hasChildren()
DOCUMENT ME! |
void |
initStats()
Initializes the statistics for this node. |
abstract boolean |
isAlphaRoad(Road r)
Checks if the given road is an alpha road of this node. |
abstract boolean |
isConnected(Road r)
Checks if the given road is connected to this node. |
abstract int |
isConnectedAt(Road r)
Finds the connection-position of a given road. |
abstract boolean |
isConnectionPosFree(int pos)
Checks if a road is connected at the given connection-position |
boolean |
isSelectable()
DOCUMENT ME! |
void |
load(XMLElement myElement,
XMLLoader loader)
Load this XMLSerializable |
void |
loadSecondStage(java.util.Dictionary dictionaries)
DOCUMENT ME! |
abstract void |
paint(java.awt.Graphics g)
DOCUMENT ME! |
abstract void |
paint(java.awt.Graphics g,
int offx,
int offy,
float zf)
DOCUMENT ME! |
void |
processStats(Roaduser ru,
int cycle,
Sign sign)
Processes the statistics of a Roaduser crossing/arriving at this node. |
abstract void |
remAllRoads()
Removes all roads from this node. |
void |
remPaths(int nodeId,
int ruType,
int length)
Removes all lanes on the path towards nodeId with length larger than length |
abstract void |
remRoad(int pos)
Removes the road at the given position from this node. |
abstract void |
remRoad(Road r)
Removes a road from this node. |
void |
reset()
Resets the data of this node. |
void |
resetStats()
Resets the statistics for this node. |
void |
saveChilds(XMLSaver saver)
DOCUMENT ME! |
XMLElement |
saveSelf()
DOCUMENT ME! |
abstract void |
setAlphaRoad(int pos)
Sets a road to be an alpha road |
void |
setCoord(java.awt.Point p)
Sets the view coordinates of this node |
void |
setId(int id)
Sets the Id of this node |
void |
setParentName(java.lang.String parentName)
DOCUMENT ME! |
void |
setShortestPath(Drivelane lane,
int nodeId,
int ruType,
int length)
Sets the shortest path for an exitnode |
abstract void |
setSigns(Sign[] s)
Sets the list of signs on this node |
protected void |
updateLanes()
Update inboundLanes,outboundLanes and outboundQueues |
void |
zapShortestPaths()
Removes all SPData, creating a new instance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jscience.architecture.traffic.xml.XMLSerializable |
|---|
getXMLName |
| Field Detail |
|---|
public static int STAT_NUM_DATA
public static final int EDGE
public static final int JUNCTION
public static final int NON_TL
public static final int NET_TUNNEL
public static final int C_UP
public static final int C_RIGHT
public static final int C_DOWN
public static final int C_LEFT
public static final int D_BACK
public static final int D_RIGHT
public static final int D_AHEAD
public static final int D_LEFT
protected int nodeId
protected SPData spdata
protected java.awt.Point coord
protected Node.NodeStatistics[] statistics
protected Drivelane[] inboundLanes
protected Drivelane[] outboundLanes
protected java.lang.String parentName
| Constructor Detail |
|---|
protected Node(java.awt.Point c)
c - DOCUMENT ME!protected Node()
| Method Detail |
|---|
public int getId()
public void setId(int id)
id - DOCUMENT ME!public java.awt.Point getCoord()
public void setCoord(java.awt.Point p)
p - DOCUMENT ME!public Node.NodeStatistics[] getStatistics()
public Node.NodeStatistics getStatistics(int ruType)
ruType - The roaduser type to return statistics of. (0 if all
roadusers)
public static int getDirection(int src,
int dest)
src - The position of the source road (expressed in a C_ constant,
see above)dest - The position of the destination road (expressed in a C_
constant, see above)
public int getNumSkip(int direction,
int laneNumber)
throws InfraException
direction - The direction in which the roaduser is goinglaneNumber - The position in the road of the lane from which the
roaduser is coming. (0=rightmost lane)
InfraException - DOCUMENT ME!public void initStats()
public void resetStats()
public void processStats(Roaduser ru,
int cycle,
Sign sign)
ru - The Roaduser to process.cycle - The current cycle.sign - The Sign the Roaduser is currently passing by.
protected abstract int calcDelay(Roaduser ru,
int cycle,
int distance)
ru - DOCUMENT ME!cycle - DOCUMENT ME!distance - DOCUMENT ME!
public void load(XMLElement myElement,
XMLLoader loader)
throws XMLTreeException,
java.io.IOException,
XMLInvalidInputException
XMLSerializable
load in interface XMLSerializablemyElement - The XMLElement which represents this object in the XML
tree. It can contain attributes which hold information about the
object.loader - The XMLLoader which this XMLSerializable can use to load
child objects.
XMLTreeException - The parser can throw this exception if it is
called by the XMLSerializable. The XMLSerializable should NOT
throw this exception by itself and preferrably not catch it
too.
java.io.IOException - Thrown in case of an read error in the XML file.
XMLInvalidInputException - The XMLSerializable can throw this
exception if it cannot load itself or one of its child objects
for whatever reason.
public XMLElement saveSelf()
throws XMLCannotSaveException
saveSelf in interface XMLSerializableXMLCannotSaveException - DOCUMENT ME!
public void saveChilds(XMLSaver saver)
throws XMLTreeException,
java.io.IOException,
XMLCannotSaveException
saveChilds in interface XMLSerializablesaver - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLCannotSaveException - DOCUMENT ME!
public void loadSecondStage(java.util.Dictionary dictionaries)
throws XMLInvalidInputException,
XMLTreeException
loadSecondStage in interface TwoStageLoaderdictionaries - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!public void setParentName(java.lang.String parentName)
setParentName in interface XMLSerializableparentName - DOCUMENT ME!public boolean canCreateInstance(java.lang.Class request)
canCreateInstance in interface InstantiationAssistantrequest - DOCUMENT ME!
public java.lang.Object createInstance(java.lang.Class request)
throws java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException
createInstance in interface InstantiationAssistantrequest - DOCUMENT ME!
java.lang.ClassNotFoundException - DOCUMENT ME!
java.lang.InstantiationException - DOCUMENT ME!
java.lang.IllegalAccessException - DOCUMENT ME!public java.awt.Rectangle getBounds()
Selectable
getBounds in interface Selectablepublic java.awt.Shape getComplexBounds()
getComplexBounds in interface Selectablepublic java.awt.Point getSelectionPoint()
getSelectionPoint in interface Selectablepublic java.awt.Point[] getSelectionPoints()
getSelectionPoints in interface Selectablepublic java.awt.Point getCenterPoint()
getCenterPoint in interface Selectablepublic int getDistance(java.awt.Point p)
getDistance in interface Selectablep - DOCUMENT ME!
public boolean hasChildren()
hasChildren in interface SelectionStarterpublic boolean isSelectable()
isSelectable in interface Selectablepublic java.util.Enumeration getChildren()
getChildren in interface SelectionStarter
public abstract void paint(java.awt.Graphics g)
throws TrafficException
g - DOCUMENT ME!
TrafficException - DOCUMENT ME!
public abstract void paint(java.awt.Graphics g,
int offx,
int offy,
float zf)
throws TrafficException
g - DOCUMENT ME!offx - DOCUMENT ME!offy - DOCUMENT ME!zf - DOCUMENT ME!
TrafficException - DOCUMENT ME!public abstract int getType()
public abstract java.lang.String getName()
public abstract Road[] getAllRoads()
public abstract Road[] getAlphaRoads()
public abstract int getWidth()
public void reset()
Road.reset()
public abstract void addRoad(Road r,
int pos)
throws InfraException
r - The road to addpos - The connection-position to connect this road at
InfraException - if a road is already connected at the given
position
public abstract void setAlphaRoad(int pos)
throws InfraException
pos - The connection-position the road is connected at
InfraException - if no road is connected at the given position
public abstract void remRoad(int pos)
throws InfraException
pos - The connection-position of the road to remove
InfraException - if no road is connected at the given position
public abstract void remRoad(Road r)
throws InfraException
r - The road to remove
InfraException - if r is null
public abstract void remAllRoads()
throws InfraException
InfraException - DOCUMENT ME!
public abstract void setSigns(Sign[] s)
throws InfraException
s - The new signs
InfraException - DOCUMENT ME!
public abstract int getDesiredSignType()
throws InfraException
InfraException - DOCUMENT ME!
public abstract boolean isAlphaRoad(Road r)
throws InfraException
r - The road to check
InfraException - if r is null
public abstract boolean isConnected(Road r)
throws InfraException
r - The road to check
InfraException - if r is null
public abstract int isConnectedAt(Road r)
throws InfraException
r - The road to find the connection-position of
InfraException - if r is null
public abstract boolean isConnectionPosFree(int pos)
throws InfraException
pos - The position to check
InfraException - if the given position is not a valid
connection-positionpublic abstract int getNumRoads()
public abstract int getNumAlphaRoads()
public abstract int getNumInboundLanes()
throws InfraException
InfraException - DOCUMENT ME!
public abstract int getNumOutboundLanes()
throws InfraException
InfraException - DOCUMENT ME!public abstract int getNumAllLanes()
public abstract int getNumSigns()
public abstract int getNumRealSigns()
public abstract Drivelane[] getLanesLeadingTo(Drivelane lane,
int ruType)
throws InfraException
lane - Outbound lane the lanes lead toruType - The type of roaduser the inbound lanes should support
InfraException - if the given lane is not an outbound lane on this
node
public abstract Drivelane[] getLanesLeadingFrom(Drivelane lane,
int ruType)
throws InfraException
lane - Inbound laneruType - The type of roaduser the outbound lanes should support
InfraException - if the given lane is not an inbound lane on this
node
public abstract Drivelane[] getOutboundLanes()
throws InfraException
InfraException - DOCUMENT ME!
public abstract Drivelane[] getInboundLanes()
throws InfraException
InfraException - DOCUMENT ME!
public abstract Drivelane[] getAllLanes()
throws InfraException
InfraException - DOCUMENT ME!
protected void updateLanes()
throws InfraException
InfraException - DOCUMENT ME!public boolean areAllTailsFree()
public void setShortestPath(Drivelane lane,
int nodeId,
int ruType,
int length)
lane - DOCUMENT ME!nodeId - DOCUMENT ME!ruType - DOCUMENT ME!length - DOCUMENT ME!
public void addShortestPath(Drivelane lane,
int nodeId,
int ruType,
int length)
lane - DOCUMENT ME!nodeId - DOCUMENT ME!ruType - DOCUMENT ME!length - DOCUMENT ME!
public Drivelane[] getShortestPaths(int nodeID,
int ruType)
nodeID - DOCUMENT ME!ruType - DOCUMENT ME!
public int[] getShortestPathDestinations(int ruType)
ruType - DOCUMENT ME!
public void remPaths(int nodeId,
int ruType,
int length)
nodeId - DOCUMENT ME!ruType - DOCUMENT ME!length - DOCUMENT ME!public void zapShortestPaths()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||