jist.swans.runway
Class RunWay

java.lang.Object
  extended by jist.swans.runway.RunWay

public class RunWay
extends java.lang.Object


Nested Class Summary
 class RunWay.Lane
          gère une file
 
Field Summary
protected  float avgTargetSpeed
           
protected  boolean circulaire
           
protected  jist.swans.field.FieldInterface field
           
protected  float intensity
           
protected  RunWay.Lane[] lanes
           
protected  float laneSize
           
protected  NewCarEventInterface newCarEventInterface
           
protected  int nextId
           
protected  PlacementInterface placement
           
protected  jist.swans.misc.Location pos
           
protected  float precision
           
 Random rand
           
protected  float rwSize
           
protected  boolean sens
           
protected  RunWayCar.RunWayCarStats stats
           
 
Constructor Summary
RunWay(int nbrLane, float laneSize, float rwSize, float avgTargetSpeed, float intensity, float precision, boolean sens, jist.swans.misc.Location.Location2D loc)
           
 
Method Summary
 RunWayCar beginEnumCar(int lane)
           
 jist.swans.misc.Location calcLocation(float loc, int lane)
           
 void changeLane(RunWayCar car, int oldLane, int newLane)
           
 RunWayCar enumCar(int lane, RunWayCar prevCar)
           
 float getAvgTargetSpeed()
           
 jist.swans.misc.Location getCarLocation(RunWayCar car)
           
 RunWayCar getFirstCar(int lane)
           
 float getIntensity()
           
 float getLaneSize()
           
protected  RunWayCar getLead(int lane, RunWayCar car)
          retourne le leader sur la voie lane par rapport à la voiture car
protected  RunWayCar getLeadL(int lane, RunWayCar car)
          retourne le leader de gauche par rapport à la voiture car qui est sur lane
protected  RunWayCar getLeadR(int lane, RunWayCar car)
          retourne le leader de droite par rapport à la voiture car qui est sur lane
 int getNbrLan()
           
 int getNextId()
           
 jist.swans.misc.Location getPos()
           
 float getPrecision()
           
 float getRwSize()
           
 void init()
           
 RunWayCar initCar(java.lang.Integer id, jist.swans.misc.Location loc)
           
 RunWayCar initCar(java.lang.Integer id, jist.swans.misc.Location loc, RunWayCar.RunWayCarStats stats)
           
 boolean isCirculaire()
           
 int nbrCar()
           
 void next()
           
 void next(long timeSleep)
           
 void setAvgTargetSpeed(float avgTargetSpeed)
           
 void setCarsStats(RunWayCar.RunWayCarStats stats)
           
 void setCirculaire(boolean circulaire)
           
 void setField(jist.swans.field.FieldInterface field)
           
 void setNewCarEvent(NewCarEventInterface newCarEventInterface)
           
 void setNextId(int nextId)
           
 void setPlacement(PlacementInterface placement)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lanes

protected RunWay.Lane[] lanes

laneSize

protected float laneSize

rwSize

protected float rwSize

avgTargetSpeed

protected float avgTargetSpeed

intensity

protected float intensity

precision

protected float precision

stats

protected RunWayCar.RunWayCarStats stats

sens

protected boolean sens

pos

protected jist.swans.misc.Location pos

newCarEventInterface

protected NewCarEventInterface newCarEventInterface

placement

protected PlacementInterface placement

field

protected jist.swans.field.FieldInterface field

nextId

protected int nextId

circulaire

protected boolean circulaire

rand

public Random rand
Constructor Detail

RunWay

public RunWay(int nbrLane,
              float laneSize,
              float rwSize,
              float avgTargetSpeed,
              float intensity,
              float precision,
              boolean sens,
              jist.swans.misc.Location.Location2D loc)
Method Detail

init

public void init()

initCar

public RunWayCar initCar(java.lang.Integer id,
                         jist.swans.misc.Location loc,
                         RunWayCar.RunWayCarStats stats)

initCar

public RunWayCar initCar(java.lang.Integer id,
                         jist.swans.misc.Location loc)

next

public void next()

next

public void next(long timeSleep)

changeLane

public void changeLane(RunWayCar car,
                       int oldLane,
                       int newLane)

getLeadR

protected RunWayCar getLeadR(int lane,
                             RunWayCar car)
retourne le leader de droite par rapport à la voiture car qui est sur lane

Parameters:
lane - voie
car - voiture
Returns:
le leader

getLeadL

protected RunWayCar getLeadL(int lane,
                             RunWayCar car)
retourne le leader de gauche par rapport à la voiture car qui est sur lane

Parameters:
lane - voie
car - voiture
Returns:
le leader

getLead

protected RunWayCar getLead(int lane,
                            RunWayCar car)
retourne le leader sur la voie lane par rapport à la voiture car

Parameters:
lane - voie
car - voiture
Returns:
le leader

beginEnumCar

public RunWayCar beginEnumCar(int lane)

enumCar

public RunWayCar enumCar(int lane,
                         RunWayCar prevCar)

calcLocation

public jist.swans.misc.Location calcLocation(float loc,
                                             int lane)

getCarLocation

public jist.swans.misc.Location getCarLocation(RunWayCar car)

nbrCar

public int nbrCar()

getPrecision

public float getPrecision()

getIntensity

public float getIntensity()

getNbrLan

public int getNbrLan()

getLaneSize

public float getLaneSize()

getAvgTargetSpeed

public float getAvgTargetSpeed()

getFirstCar

public RunWayCar getFirstCar(int lane)

getRwSize

public float getRwSize()

setAvgTargetSpeed

public void setAvgTargetSpeed(float avgTargetSpeed)

setCarsStats

public void setCarsStats(RunWayCar.RunWayCarStats stats)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPos

public jist.swans.misc.Location getPos()

setNewCarEvent

public void setNewCarEvent(NewCarEventInterface newCarEventInterface)

setPlacement

public void setPlacement(PlacementInterface placement)

setField

public void setField(jist.swans.field.FieldInterface field)

getNextId

public int getNextId()

setNextId

public void setNextId(int nextId)

isCirculaire

public boolean isCirculaire()

setCirculaire

public void setCirculaire(boolean circulaire)