Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

traffic
Class OCity  view OCity download OCity.java

java.lang.Object
  extended bytraffic.OCity
All Implemented Interfaces:
java.io.Serializable

public class OCity
extends java.lang.Object
implements java.io.Serializable

Senior data object. Contains OStreet, OIntersection and UQuery objects. Also contains various citywide default values.

Since:
2003/06/07 04:25:52
Version:
1.7, 2003/08/01 17:39:53

Field Summary
protected  java.lang.String cityname
          The city name and the file name for storage
protected static int CONMAX
          The number of UQuery constants
private  java.lang.String dunits
           
protected static int ELEMAX
          The number of UQuery elements
private  float htsec
           
private  java.util.Vector Intrs
           
protected static int LOCMAX
          The number of UQuery locations
private  float ltpct
           
private  int ltque
           
private  boolean mapped
           
protected static int METHMAX
          The number of UQuery methods
private  boolean metric
           
private  float mzoom
           
private  UQuery query
           
private  float rtpct
           
private  int rtque
           
private  java.util.Vector stv
           
private  java.lang.String sunits
           
private  float vlength
           
private  float vsep
           
private  float vspd
           
private  float wtsec
           
 
Constructor Summary
OCity(java.lang.String name)
          Constructs a new and empty OCity data object.
 
Method Summary
 void addIntrs(int index, OIntersection nint)
          Adds the OIntersection to the OCity at a specific location.
 void addSt(int index, OStreet street)
          Adds the OStreet to the OCity at a specific location.
 void changeSt(OStreet ost, OStreet nst)
          Replaces an OStreet in the OCity.
 float cvtDtoT(float dist, int speed)
          Converts distance to time using the speed limit and the metric state
 float cvtTtoD(float time, int speed)
          Converts time to distance using the speed limit and the metric state
 void deleteIntrs(OIntersection oint)
          Deletes the OIntersection from the OCity.
 void deleteSt(OStreet street)
          Removes an OStreet object from the OCity.
 void expungeTraffic()
          Removes all vehicles from the streets and sets the time and all of the lights back to their starting points.
 java.lang.String getCtyName()
          Gets the OCity name
 java.lang.String getDUnits()
          Gets the OCity distance units (meters/yards)
 float getHTSec()
          Gets the OCity default halt time in seconds.
 int getIntrsCount()
          Gets the OIntersection count within the OCity.
 int getIntrsIndex(OIntersection nint)
          Gets the OIntersection index within the OCity.
 float getLeftPCT()
          Gets the OCity default left turn preference percent.
 int getLeftQue()
          Gets the OCity default left turn queue length.
 float getMZoom()
          Gets the OCity zoom value.
 float getRightPCT()
          Gets the OCity default right turn preference percent.
 int getRightQue()
          Gets the OCity default right turn queue length.
 float getSpeed()
          Gets the OCity default Speed.
 int getStCount()
          Gets the count of OStreets in the OCity.
 java.lang.String getSUnits()
          Gets the OCity speed units (KPH/MPH)
 UQuery getUQuery()
          Gets the UQuery object
 float getVLength()
          Gets the OCity default vehicle length
 float getVSep()
          Gets the OCity default vehicle separation (back to front bumper)
 float getWTSec()
          Gets the OCity default wait time in seconds.
 boolean isMapped()
          True if OCity has been mapped
 boolean isMetric()
          True if OCity is metric
 void setCtyName(java.lang.String name)
          Sets the OCity name
 void setHTSec(float hsec)
          Sets the OCity default halt time in seconds.
 void setLeftPCT(float lpct)
          Sets the OCity default left turn preference percent.
 void setLeftQue(int lque)
          Sets the OCity default left turn queue length.
 void setMapped(boolean state)
          Sets the OCity mapped state.
 void setMetric(boolean state)
          Sets the OCity metric state
 void setMZoom(float zoom)
          Sets the OCity zoom value.
 void setRightPCT(float rpct)
          Sets the OCity default right turn preference percent.
 void setRightQue(int rque)
          Sets the OCity default right turn queue length.
 void setSpeed(float spd)
          Sets the OCity default Speed.
 void setUnits()
          Determine whether metric or EE units will be used
 void setUQuery(UQuery lquery)
          Sets the UQuery object
 void setVLength(float lth)
          Sets the OCity default vehicle length
 void setVSep(float sep)
          Sets the OCity default vehicle separation (back to front bumper)
 void setWTSec(float wsec)
          Sets the OCity default wait time in seconds.
 void unMapAll()
          Sets the mapped switches to false on all objects that have such switches so that the city can be mapped anew.
 OIntersection useIntrs(int index)
          Gets an OIntersection object.
 OIntersection useIntrs(OIntersection oint)
          Gets an OIntersection object.
 OStreet useSt(int index)
          Gets an OStreet object.
 OStreet useSt(OStreet ost)
          Gets an OStreet object.
 OStreet useSt(java.lang.String stname)
          Gets an OStreet object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cityname

protected java.lang.String cityname
The city name and the file name for storage


LOCMAX

protected static final int LOCMAX
The number of UQuery locations

See Also:
Constant Field Values

CONMAX

protected static final int CONMAX
The number of UQuery constants

See Also:
Constant Field Values

METHMAX

protected static final int METHMAX
The number of UQuery methods

See Also:
Constant Field Values

ELEMAX

protected static final int ELEMAX
The number of UQuery elements

See Also:
Constant Field Values

dunits

private java.lang.String dunits

sunits

private java.lang.String sunits

metric

private boolean metric

mapped

private boolean mapped

vlength

private float vlength

vsep

private float vsep

vspd

private float vspd

rtpct

private float rtpct

rtque

private int rtque

ltpct

private float ltpct

ltque

private int ltque

wtsec

private float wtsec

htsec

private float htsec

mzoom

private float mzoom

query

private UQuery query

stv

private java.util.Vector stv

Intrs

private java.util.Vector Intrs
Constructor Detail

OCity

public OCity(java.lang.String name)
Constructs a new and empty OCity data object.

Method Detail

getCtyName

public java.lang.String getCtyName()
Gets the OCity name


setCtyName

public void setCtyName(java.lang.String name)
Sets the OCity name


getDUnits

public java.lang.String getDUnits()
Gets the OCity distance units (meters/yards)


getSUnits

public java.lang.String getSUnits()
Gets the OCity speed units (KPH/MPH)


setUnits

public void setUnits()
Determine whether metric or EE units will be used


setMetric

public void setMetric(boolean state)
Sets the OCity metric state


isMetric

public boolean isMetric()
True if OCity is metric


cvtTtoD

public float cvtTtoD(float time,
                     int speed)
Converts time to distance using the speed limit and the metric state


cvtDtoT

public float cvtDtoT(float dist,
                     int speed)
Converts distance to time using the speed limit and the metric state


getVLength

public float getVLength()
Gets the OCity default vehicle length


setVLength

public void setVLength(float lth)
Sets the OCity default vehicle length


getVSep

public float getVSep()
Gets the OCity default vehicle separation (back to front bumper)


setVSep

public void setVSep(float sep)
Sets the OCity default vehicle separation (back to front bumper)


getSpeed

public float getSpeed()
Gets the OCity default Speed. Speed is a multiplier which determines a vehicles interpretation of the posted speed (OFragment.MPH). If the MPH is 30 and the speed is 1.1 the vehicle is actually traveling at 33 MPH. The OVehicle Speed is the actual current speed.


setSpeed

public void setSpeed(float spd)
Sets the OCity default Speed.


setRightPCT

public void setRightPCT(float rpct)
Sets the OCity default right turn preference percent.


getRightPCT

public float getRightPCT()
Gets the OCity default right turn preference percent.


setLeftPCT

public void setLeftPCT(float lpct)
Sets the OCity default left turn preference percent.


getLeftPCT

public float getLeftPCT()
Gets the OCity default left turn preference percent.


setLeftQue

public void setLeftQue(int lque)
Sets the OCity default left turn queue length.


getLeftQue

public int getLeftQue()
Gets the OCity default left turn queue length.


setRightQue

public void setRightQue(int rque)
Sets the OCity default right turn queue length.


getRightQue

public int getRightQue()
Gets the OCity default right turn queue length.


setMZoom

public void setMZoom(float zoom)
Sets the OCity zoom value.


getMZoom

public float getMZoom()
Gets the OCity zoom value.


setWTSec

public void setWTSec(float wsec)
Sets the OCity default wait time in seconds. Wait or stop gap is the required space between a waiting car and an oncomming car before the waiting car will leave a stop sign.


getWTSec

public float getWTSec()
Gets the OCity default wait time in seconds.


setHTSec

public void setHTSec(float hsec)
Sets the OCity default halt time in seconds. Halt is the amount of time that a car will stop and sit at a stop sign even when there is no traffic comming.


getHTSec

public float getHTSec()
Gets the OCity default halt time in seconds.


isMapped

public boolean isMapped()
True if OCity has been mapped


setMapped

public void setMapped(boolean state)
Sets the OCity mapped state.


unMapAll

public void unMapAll()
Sets the mapped switches to false on all objects that have such switches so that the city can be mapped anew.


expungeTraffic

public void expungeTraffic()
Removes all vehicles from the streets and sets the time and all of the lights back to their starting points.


getUQuery

public UQuery getUQuery()
Gets the UQuery object


setUQuery

public void setUQuery(UQuery lquery)
Sets the UQuery object


useSt

public OStreet useSt(int index)
Gets an OStreet object.


useSt

public OStreet useSt(java.lang.String stname)
Gets an OStreet object.


useSt

public OStreet useSt(OStreet ost)
Gets an OStreet object. The 'old' object and the new object are identical, but the new object is attached to the OCity and the old object is not.


addSt

public void addSt(int index,
                  OStreet street)
Adds the OStreet to the OCity at a specific location.


deleteSt

public void deleteSt(OStreet street)
Removes an OStreet object from the OCity. This method also takes care of any OIntersections where the street was being used.


changeSt

public void changeSt(OStreet ost,
                     OStreet nst)
Replaces an OStreet in the OCity.


getStCount

public int getStCount()
Gets the count of OStreets in the OCity.


useIntrs

public OIntersection useIntrs(int index)
Gets an OIntersection object.


useIntrs

public OIntersection useIntrs(OIntersection oint)
Gets an OIntersection object. The 'old' object and the new object are identical, but the new object is attached to the OCity and the old object is not.


addIntrs

public void addIntrs(int index,
                     OIntersection nint)
Adds the OIntersection to the OCity at a specific location.


deleteIntrs

public void deleteIntrs(OIntersection oint)
Deletes the OIntersection from the OCity.


getIntrsCount

public int getIntrsCount()
Gets the OIntersection count within the OCity.


getIntrsIndex

public int getIntrsIndex(OIntersection nint)
Gets the OIntersection index within the OCity.