org.jscience.architecture.traffic.infrastructure
Class SPData

java.lang.Object
  extended by org.jscience.architecture.traffic.infrastructure.SPData
All Implemented Interfaces:
InstantiationAssistant, TwoStageLoader, XMLSerializable

public class SPData
extends java.lang.Object
implements XMLSerializable, TwoStageLoader, InstantiationAssistant

Holds data needed to find the shortest path from a node to an exit node.


Nested Class Summary
protected  class SPData.Path
          One Path holds all known Drivelanes that are on a shortest path to a given exitNode using a Roaduser with a certain type, starting at the Node SPData belongs to
 
Field Summary
protected  java.lang.String parentName
          DOCUMENT ME!
protected  java.util.Vector paths
          The paths known
 
Constructor Summary
SPData()
          Creates a new SPData object.
SPData(int size)
          Creates a new SPData object.
 
Method Summary
 void addShortestPath(Drivelane lane, int exitNodeId, int ruType, int length)
          Adds a Drivelane to the lanes already found for exitNodeId and ruType.
 boolean canCreateInstance(java.lang.Class request)
          DOCUMENT ME!
 java.lang.Object createInstance(java.lang.Class request)
          DOCUMENT ME!
 int[] getShortestPathDestinations(int ruType)
          DOCUMENT ME!
 Drivelane[] getShortestPaths(int exitNodeId, int ruType)
          Returns an array of Drivelanes that are on 1 of the shortest paths from the node this SPData belongs to, to the Node with exiNodeId, for Roadusers with type ruType.
 java.lang.String getXMLName()
          DOCUMENT ME!
 void load(XMLElement myElement, XMLLoader loader)
          Load this XMLSerializable
 void loadSecondStage(java.util.Dictionary dictionaries)
          DOCUMENT ME!
 void remAllPaths(int exitNodeId, int ruType)
          Removes all Drivelanes found for exitNodeId and ruType.
 void remPaths(int exitId, int ruType, int length)
          Removes all the Drivelanes found for exitNodeId and ruType and length > length
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setParentName(java.lang.String parentName)
          DOCUMENT ME!
 void setShortestPath(Drivelane lane, int exitNodeId, int ruType, int length)
          Sets the shortest path to given exit node using roaduser type to given Drivelane
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paths

protected java.util.Vector paths
The paths known


parentName

protected java.lang.String parentName
DOCUMENT ME!

Constructor Detail

SPData

public SPData()
Creates a new SPData object.


SPData

public SPData(int size)
Creates a new SPData object.

Parameters:
size - DOCUMENT ME!
Method Detail

getShortestPaths

public Drivelane[] getShortestPaths(int exitNodeId,
                                    int ruType)
Returns an array of Drivelanes that are on 1 of the shortest paths from the node this SPData belongs to, to the Node with exiNodeId, for Roadusers with type ruType.

Parameters:
exitNodeId - The Id of the exit node that is your destination.
ruType - The type of Roaduser.
Returns:
an array of Drivelanes.

getShortestPathDestinations

public int[] getShortestPathDestinations(int ruType)
DOCUMENT ME!

Parameters:
ruType - DOCUMENT ME!
Returns:
DOCUMENT ME!

setShortestPath

public void setShortestPath(Drivelane lane,
                            int exitNodeId,
                            int ruType,
                            int length)
Sets the shortest path to given exit node using roaduser type to given Drivelane

Parameters:
lane - The Drivelane to set the path to
exitNodeId - The Id of the exit node this path leads to
ruType - The type of Roaduser
length - DOCUMENT ME!

addShortestPath

public void addShortestPath(Drivelane lane,
                            int exitNodeId,
                            int ruType,
                            int length)
Adds a Drivelane to the lanes already found for exitNodeId and ruType.

Parameters:
lane - The Drivelane to add to the path
exitNodeId - The Id of the exit node this path leads to
ruType - The type of Roaduser
length - DOCUMENT ME!

remAllPaths

public void remAllPaths(int exitNodeId,
                        int ruType)
Removes all Drivelanes found for exitNodeId and ruType.

Parameters:
exitNodeId - The Id of the exit node this path leads to
ruType - The type of Roaduser

remPaths

public void remPaths(int exitId,
                     int ruType,
                     int length)
Removes all the Drivelanes found for exitNodeId and ruType and length > length

Parameters:
exitId - The Id of the exit node this path leads to
ruType - The type of Roaduser
length - The maximum length a path may have to remain

load

public void load(XMLElement myElement,
                 XMLLoader loader)
          throws XMLTreeException,
                 java.io.IOException,
                 XMLInvalidInputException
Description copied from interface: XMLSerializable
Load this XMLSerializable

Specified by:
load in interface XMLSerializable
Parameters:
myElement - 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.
Throws:
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.

saveSelf

public XMLElement saveSelf()
                    throws XMLCannotSaveException
DOCUMENT ME!

Specified by:
saveSelf in interface XMLSerializable
Returns:
DOCUMENT ME!
Throws:
XMLCannotSaveException - DOCUMENT ME!

saveChilds

public void saveChilds(XMLSaver saver)
                throws XMLTreeException,
                       java.io.IOException,
                       XMLCannotSaveException
DOCUMENT ME!

Specified by:
saveChilds in interface XMLSerializable
Parameters:
saver - DOCUMENT ME!
Throws:
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLCannotSaveException - DOCUMENT ME!

getXMLName

public java.lang.String getXMLName()
DOCUMENT ME!

Specified by:
getXMLName in interface XMLSerializable
Returns:
DOCUMENT ME!

setParentName

public void setParentName(java.lang.String parentName)
DOCUMENT ME!

Specified by:
setParentName in interface XMLSerializable
Parameters:
parentName - DOCUMENT ME!

loadSecondStage

public void loadSecondStage(java.util.Dictionary dictionaries)
                     throws XMLInvalidInputException,
                            XMLTreeException
DOCUMENT ME!

Specified by:
loadSecondStage in interface TwoStageLoader
Parameters:
dictionaries - DOCUMENT ME!
Throws:
XMLInvalidInputException - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!

canCreateInstance

public boolean canCreateInstance(java.lang.Class request)
DOCUMENT ME!

Specified by:
canCreateInstance in interface InstantiationAssistant
Parameters:
request - DOCUMENT ME!
Returns:
DOCUMENT ME!

createInstance

public java.lang.Object createInstance(java.lang.Class request)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.InstantiationException,
                                       java.lang.IllegalAccessException
DOCUMENT ME!

Specified by:
createInstance in interface InstantiationAssistant
Parameters:
request - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.ClassNotFoundException - DOCUMENT ME!
java.lang.InstantiationException - DOCUMENT ME!
java.lang.IllegalAccessException - DOCUMENT ME!