org.jscience.architecture.traffic.infrastructure
Class Sign

java.lang.Object
  extended by org.jscience.architecture.traffic.infrastructure.Sign
All Implemented Interfaces:
TwoStageLoader, XMLSerializable
Direct Known Subclasses:
NoSign, TrafficLight

public abstract class Sign
extends java.lang.Object
implements XMLSerializable, TwoStageLoader

Sign class.


Field Summary
protected  Drivelane lane
          DOCUMENT ME!
protected  org.jscience.architecture.traffic.infrastructure.Sign.TwoStageLoaderData loadData
          Data for loading the second stage
static int NO_SIGN
          DOCUMENT ME!
protected  Node node
          DOCUMENT ME!
protected  java.lang.String parentName
          DOCUMENT ME!
static int SIGN
          DOCUMENT ME!
protected  boolean state
          DOCUMENT ME!
static int TRAFFICLIGHT
          DOCUMENT ME!
 
Constructor Summary
Sign()
          Creates a new Sign object.
Sign(Node _node, Drivelane _lane)
          Creates a new Sign object.
 
Method Summary
 int getId()
          Returns the Id of this sign.
static Sign getInstance(int type)
          Smallest factory ever
 Drivelane getLane()
          Returns the Drivelane this Sign is on
 Node getNode()
          Returns the Node this Sign is on
 boolean getState()
          Returns the current state
abstract  int getType()
          Returns the type of this Sign
 void load(XMLElement myElement, XMLLoader loader)
          DOCUMENT ME!
 void loadSecondStage(java.util.Dictionary dictionaries)
          DOCUMENT ME!
 boolean mayDrive()
          Returns true if the Roaduser at the start of the Drivelane may cross the Node.
abstract  boolean needsExternalAlgorithm()
          Returns true if this Sign should be handled by an external algorithm (TC-3 for example)
 void reset()
          This will reset the sign to its default state (false)
 void saveChilds(XMLSaver saver)
          DOCUMENT ME!
 XMLElement saveSelf()
          DOCUMENT ME!
 void setLane(Drivelane l)
          Sets the Drivelane this Sign is on
 void setNode(Node n)
          Sets the Node this Sign is on
 void setParentName(java.lang.String parentName)
          DOCUMENT ME!
 void setState(boolean b)
          Sets the current state
 
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

SIGN

public static final int SIGN
DOCUMENT ME!

See Also:
Constant Field Values

TRAFFICLIGHT

public static final int TRAFFICLIGHT
DOCUMENT ME!

See Also:
Constant Field Values

NO_SIGN

public static final int NO_SIGN
DOCUMENT ME!

See Also:
Constant Field Values

state

protected boolean state
DOCUMENT ME!


node

protected Node node
DOCUMENT ME!


lane

protected Drivelane lane
DOCUMENT ME!


loadData

protected org.jscience.architecture.traffic.infrastructure.Sign.TwoStageLoaderData loadData
Data for loading the second stage


parentName

protected java.lang.String parentName
DOCUMENT ME!

Constructor Detail

Sign

public Sign(Node _node,
            Drivelane _lane)
Creates a new Sign object.

Parameters:
_node - DOCUMENT ME!
_lane - DOCUMENT ME!

Sign

public Sign()
Creates a new Sign object.

Method Detail

getInstance

public static Sign getInstance(int type)
                        throws InfraException
Smallest factory ever

Parameters:
type - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
InfraException - DOCUMENT ME!

reset

public void reset()
This will reset the sign to its default state (false)


needsExternalAlgorithm

public abstract boolean needsExternalAlgorithm()
Returns true if this Sign should be handled by an external algorithm (TC-3 for example)

Returns:
DOCUMENT ME!

mayDrive

public boolean mayDrive()
Returns true if the Roaduser at the start of the Drivelane may cross the Node. Default behavior is implemented to return state. Any Sign using an external algorithm does not need to override this method.

Returns:
DOCUMENT ME!

getId

public int getId()
Returns the Id of this sign. It is the same as the Id of the drivelane this sign is on.

Returns:
DOCUMENT ME!

getState

public boolean getState()
Returns the current state

Returns:
DOCUMENT ME!

setState

public void setState(boolean b)
Sets the current state

Parameters:
b - DOCUMENT ME!

getLane

public Drivelane getLane()
Returns the Drivelane this Sign is on

Returns:
DOCUMENT ME!

setLane

public void setLane(Drivelane l)
Sets the Drivelane this Sign is on

Parameters:
l - DOCUMENT ME!

getNode

public Node getNode()
Returns the Node this Sign is on

Returns:
DOCUMENT ME!

setNode

public void setNode(Node n)
Sets the Node this Sign is on

Parameters:
n - DOCUMENT ME!

getType

public abstract int getType()
Returns the type of this Sign

Returns:
DOCUMENT ME!

load

public void load(XMLElement myElement,
                 XMLLoader loader)
          throws XMLTreeException,
                 java.io.IOException,
                 XMLInvalidInputException
DOCUMENT ME!

Specified by:
load in interface XMLSerializable
Parameters:
myElement - DOCUMENT ME!
loader - DOCUMENT ME!
Throws:
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!

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!

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!