Class JunctionModel

java.lang.Object
  |
  +--JunctionModel
All Implemented Interfaces:
Timed
Direct Known Subclasses:
BridgeJunctionModel, GiveWayJunctionModel, Sig1JunctionModel, TurnOffJunctionModel

public abstract class JunctionModel
extends java.lang.Object
implements Timed


Field Summary
protected  int[] ei
           
protected  int[][] endLanesID
           
protected  int iD
           
protected  java.awt.Shape junctionShape
           
protected  int maxNum
           
protected  RoadNetwork parent
           
protected  JunctionPath[][] paths
           
protected  int[] pi
           
protected  int[] si
           
protected  int[][] startLanesID
           
protected  TimeManager ticker
           
protected  int totalNumPaths
           
 
Constructor Summary
JunctionModel(int iD, java.awt.Shape s, RoadNetwork parent)
           
 
Method Summary
 void addEndLane(int laneID, int junctionSide)
           
 void addStartLane(int laneID, int junctionSide)
           
 void addToTimer(TimeManager theTick)
           
protected  int convertToArrayConvienient(int dir)
           
 boolean createAnyLeft(int dir, int num)
           
 boolean createAnyOpposite(int dir, int num)
           
 boolean createAnyRight(int dir, int num)
           
 boolean createcorrespondingLeft(int dir, int num)
           
 boolean createcorrespondingRight(int dir, int num)
           
 void createLeftTurns(int dir, int num)
           
 boolean createPathBetween(int dir1, int dir2, int num)
           
 boolean createPathBetween(int dir1, int no1, int dir2, int no2)
           
 boolean createPathToOppositeSide(int dir, int num)
           
 void createRightTurns(int dir, int num)
           
 void drawAllCars(java.awt.Graphics2D g2d)
           
 void drawJunctionFeatures(java.awt.Graphics2D g2d)
           
 void generatePaths()
           
 int getAnOpositeLaneFromEdge(int side)
           
 int getAnOpositeLaneFromJunction(JunctionModel jun)
           
 int getAnyOutputLane(int side)
           
 Car getCar(java.awt.geom.Point2D p)
           
 java.awt.geom.Point2D getCenter()
           
 int getID()
           
protected  int getLeftDir(int dir)
           
 int getLightsFrom(int laneID)
           
 int getLightsTo(int laneID)
           
 LaneSection getnextLane(int nextLaneID)
           
protected  int getOpDir(int dir)
           
protected  int getRightDir(int dir)
           
 int getsharedPath(JunctionModel jun)
           
 int getSpeeds()
           
abstract  java.lang.String giveInfo()
          Due to mouse Events
 boolean hasInputOf(int inputJID)
           
abstract  boolean isOKToGo(Car currentcar, double currentdist)
           
 boolean isOnLeftSide(int dir, int num)
           
 boolean isOnMapEdge()
           
 boolean isOnRightSide(int dir, int num)
           
 boolean isSignalled()
           
 void kill()
           
 void pretick()
           
 CarContainer receiveCar(int laneID)
           
 void testForLiveness()
           
 void tick()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ticker

protected TimeManager ticker

iD

protected int iD

startLanesID

protected int[][] startLanesID

endLanesID

protected int[][] endLanesID

paths

protected JunctionPath[][] paths

si

protected int[] si

ei

protected int[] ei

pi

protected int[] pi

maxNum

protected int maxNum

totalNumPaths

protected int totalNumPaths

parent

protected RoadNetwork parent

junctionShape

protected java.awt.Shape junctionShape
Constructor Detail

JunctionModel

public JunctionModel(int iD,
                     java.awt.Shape s,
                     RoadNetwork parent)
Method Detail

isOKToGo

public abstract boolean isOKToGo(Car currentcar,
                                 double currentdist)

getID

public int getID()

addToTimer

public void addToTimer(TimeManager theTick)

addStartLane

public void addStartLane(int laneID,
                         int junctionSide)

addEndLane

public void addEndLane(int laneID,
                       int junctionSide)

generatePaths

public void generatePaths()

getnextLane

public LaneSection getnextLane(int nextLaneID)

receiveCar

public CarContainer receiveCar(int laneID)

drawAllCars

public void drawAllCars(java.awt.Graphics2D g2d)

drawJunctionFeatures

public void drawJunctionFeatures(java.awt.Graphics2D g2d)

kill

public void kill()

testForLiveness

public void testForLiveness()

isOnMapEdge

public boolean isOnMapEdge()

getAnOpositeLaneFromEdge

public int getAnOpositeLaneFromEdge(int side)

getAnyOutputLane

public int getAnyOutputLane(int side)

getAnOpositeLaneFromJunction

public int getAnOpositeLaneFromJunction(JunctionModel jun)

getsharedPath

public int getsharedPath(JunctionModel jun)

getLightsTo

public int getLightsTo(int laneID)

getLightsFrom

public int getLightsFrom(int laneID)

hasInputOf

public boolean hasInputOf(int inputJID)

getCenter

public java.awt.geom.Point2D getCenter()

pretick

public void pretick()
Specified by:
pretick in interface Timed

tick

public void tick()
Specified by:
tick in interface Timed

getOpDir

protected int getOpDir(int dir)

getLeftDir

protected int getLeftDir(int dir)

getRightDir

protected int getRightDir(int dir)

convertToArrayConvienient

protected int convertToArrayConvienient(int dir)

createPathToOppositeSide

public boolean createPathToOppositeSide(int dir,
                                        int num)

createPathBetween

public boolean createPathBetween(int dir1,
                                 int no1,
                                 int dir2,
                                 int no2)

createPathBetween

public boolean createPathBetween(int dir1,
                                 int dir2,
                                 int num)

isOnLeftSide

public boolean isOnLeftSide(int dir,
                            int num)

isOnRightSide

public boolean isOnRightSide(int dir,
                             int num)

createcorrespondingLeft

public boolean createcorrespondingLeft(int dir,
                                       int num)

createcorrespondingRight

public boolean createcorrespondingRight(int dir,
                                        int num)

createAnyLeft

public boolean createAnyLeft(int dir,
                             int num)

createAnyRight

public boolean createAnyRight(int dir,
                              int num)

createAnyOpposite

public boolean createAnyOpposite(int dir,
                                 int num)

createLeftTurns

public void createLeftTurns(int dir,
                            int num)

createRightTurns

public void createRightTurns(int dir,
                             int num)

isSignalled

public boolean isSignalled()

giveInfo

public abstract java.lang.String giveInfo()
Due to mouse Events


getCar

public Car getCar(java.awt.geom.Point2D p)

getSpeeds

public int getSpeeds()