org.jscience.architecture.traffic.infrastructure
Class RoaduserFactory

java.lang.Object
  extended by org.jscience.architecture.traffic.infrastructure.RoaduserFactory

public class RoaduserFactory
extends java.lang.Object

This class is used to generate new Roadusers


Field Summary
protected static int[] ALL
          All roadusers.
protected static int[] AUTOMOBILE
          All the roadusers that fit in the Automobile category
static int BICYCLE
          All the individual types of each concrete Roaduser
static int BUS
          All the individual types of each concrete Roaduser
static int CAR
          All the individual types of each concrete Roaduser
static java.awt.Color[] concreteTypeColors
          Colors for all concrete Roaduser types, corresponding to the types in concreteTypes.
static java.lang.String[] concreteTypeDescs
          Descriptions of all concrete Roaduser types, corresponding to the types in concreteTypes.
protected static int[] concreteTypes
          All concrete Roaduser types.
static float PacChance
          DOCUMENT ME!
protected static int[] PEDESTRIANS
          All the roadusers that move on foot
protected static java.util.Random rnd
          DOCUMENT ME!
static java.lang.String[] typeDescs
          Descriptions of all possible Roaduser types, corresponding to the types in types.
static int[] types
          All possible Roaduser types.
protected static int[] UNMOTORIZED
          All the other roadusers that move unmotorized
static boolean UseCustoms
          DOCUMENT ME!
 
Method Summary
static Roaduser genRoaduser(int type)
          Generate a new RoadUser
static Roaduser genRoaduser(int type, Node start, Node dest, int pos)
          Generate a new RoadUser
static java.awt.Color getColorByType(int type)
          Returns the color belonging to the type given.
static java.lang.String[] getConcreteTypeDescs()
          Returns descriptions of all concrete types of roadusers.
static int[] getConcreteTypes()
          Returns all concrete types of roadusers.
static java.lang.String getDescByConcreteType(int type)
          Returns the desc belonging to the concrete type given.
static java.lang.String getDescByStatIndex(int index)
          Returns the roaduser description belonging to the given statIndex.
static java.lang.String getDescByType(int type)
          Returns the desc belonging to the type given.
static int getNumConcreteTypes()
          Returns the number of all concrete types of roadusrs.
static int getNumTypes()
          Returns the number of possible types of roadusers.
static int getStatIndexByDesc(java.lang.String desc)
          Returns the statIndex belonging to a given roaduser description.
static int getStatIndexByType(int ruType)
          DOCUMENT ME!
protected static int getSuperType(int[] types)
          DOCUMENT ME!
static int getTypeByDesc(java.lang.String desc)
          Seeks the type number of a description of a Roaduser
static java.lang.String[] getTypeDescs()
          Returns descriptions of all possible types of roadusers
static int[] getTypes()
          Returns all possible types of roadusers
static int ruTypeToStatIndex(int ruType)
          Returns the statIndex belonging to a given concrete (!)
static int statArrayLength()
          Returns the length a statistics array should have: the number of concrete roadusers plus one (for all roadusers).
static int statIndexToRuType(int index)
          Returns the concrete ruType belonging to the given statIndex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PacChance

public static float PacChance
DOCUMENT ME!


UseCustoms

public static boolean UseCustoms
DOCUMENT ME!


rnd

protected static java.util.Random rnd
DOCUMENT ME!


CAR

public static final int CAR
All the individual types of each concrete Roaduser

See Also:
Constant Field Values

BUS

public static final int BUS
All the individual types of each concrete Roaduser

See Also:
Constant Field Values

BICYCLE

public static final int BICYCLE
All the individual types of each concrete Roaduser

See Also:
Constant Field Values

concreteTypes

protected static final int[] concreteTypes
All concrete Roaduser types.


ALL

protected static final int[] ALL
All roadusers.


AUTOMOBILE

protected static final int[] AUTOMOBILE
All the roadusers that fit in the Automobile category


PEDESTRIANS

protected static final int[] PEDESTRIANS
All the roadusers that move on foot


UNMOTORIZED

protected static final int[] UNMOTORIZED
All the other roadusers that move unmotorized


types

public static final int[] types
All possible Roaduser types.


typeDescs

public static final java.lang.String[] typeDescs
Descriptions of all possible Roaduser types, corresponding to the types in types.


concreteTypeDescs

public static final java.lang.String[] concreteTypeDescs
Descriptions of all concrete Roaduser types, corresponding to the types in concreteTypes.


concreteTypeColors

public static final java.awt.Color[] concreteTypeColors
Colors for all concrete Roaduser types, corresponding to the types in concreteTypes.

Method Detail

getTypes

public static int[] getTypes()
Returns all possible types of roadusers

Returns:
DOCUMENT ME!

getNumTypes

public static int getNumTypes()
Returns the number of possible types of roadusers.

Returns:
DOCUMENT ME!

getTypeDescs

public static java.lang.String[] getTypeDescs()
Returns descriptions of all possible types of roadusers

Returns:
DOCUMENT ME!

getConcreteTypes

public static int[] getConcreteTypes()
Returns all concrete types of roadusers.

Returns:
DOCUMENT ME!

getNumConcreteTypes

public static int getNumConcreteTypes()
Returns the number of all concrete types of roadusrs.

Returns:
DOCUMENT ME!

getConcreteTypeDescs

public static java.lang.String[] getConcreteTypeDescs()
Returns descriptions of all concrete types of roadusers.

Returns:
DOCUMENT ME!

genRoaduser

public static Roaduser genRoaduser(int type,
                                   Node start,
                                   Node dest,
                                   int pos)
                            throws InfraException
Generate a new RoadUser

Parameters:
type - The type number of the Roaduser
start - The node where the Roadusers should start.
dest - The destination node of the Roaduser
pos - The position of the Roaduser in its Drivelane
Returns:
The generated Roaduser
Throws:
InfraException - If the Roaduser cannot be generated

genRoaduser

public static Roaduser genRoaduser(int type)
                            throws InfraException
Generate a new RoadUser

Parameters:
type - The type number of the Roaduser
Returns:
The generated Roaduser
Throws:
InfraException - If the Roaduser cannot be generated

getTypeByDesc

public static int getTypeByDesc(java.lang.String desc)
Seeks the type number of a description of a Roaduser

Parameters:
desc - Description of the Roaduser type.
Returns:
The typenumber

getDescByType

public static java.lang.String getDescByType(int type)
Returns the desc belonging to the type given.

Parameters:
type - The Roaduser type to return description of.
Returns:
DOCUMENT ME!

getDescByConcreteType

public static java.lang.String getDescByConcreteType(int type)
Returns the desc belonging to the concrete type given.

Parameters:
type - The Roaduser type to return description of.
Returns:
DOCUMENT ME!

getColorByType

public static java.awt.Color getColorByType(int type)
Returns the color belonging to the type given. Colors are only defined for concrete types!

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

getSuperType

protected static int getSuperType(int[] types)
DOCUMENT ME!

Parameters:
types - DOCUMENT ME!
Returns:
DOCUMENT ME!

statArrayLength

public static int statArrayLength()
Returns the length a statistics array should have: the number of concrete roadusers plus one (for all roadusers).

Returns:
DOCUMENT ME!

getStatIndexByType

public static int getStatIndexByType(int ruType)
DOCUMENT ME!

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

ruTypeToStatIndex

public static int ruTypeToStatIndex(int ruType)
Returns the statIndex belonging to a given concrete (!) ruType.

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

statIndexToRuType

public static int statIndexToRuType(int index)
Returns the concrete ruType belonging to the given statIndex.

Parameters:
index - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDescByStatIndex

public static java.lang.String getDescByStatIndex(int index)
Returns the roaduser description belonging to the given statIndex.

Parameters:
index - DOCUMENT ME!
Returns:
DOCUMENT ME!

getStatIndexByDesc

public static int getStatIndexByDesc(java.lang.String desc)
Returns the statIndex belonging to a given roaduser description.

Parameters:
desc - DOCUMENT ME!
Returns:
DOCUMENT ME!