org.jscience.architecture.lift.ca
Class SimpleALLCA

java.lang.Object
  extended by org.jscience.architecture.lift.ca.SimpleALLCA

public class SimpleALLCA
extends java.lang.Object

This file is licensed under the GNU Public Licens (GPL).
This is SimpleALLCA that controls a Car


Field Summary
static short BOTH_WAY
          Description of the Field
protected  short Direction
          DOCUMENT ME!
static short DOWN_WAY
          Description of the Field
static short UP_WAY
          Description of the Field
 
Constructor Summary
SimpleALLCA(Car MyCar, int MyParkLevel, int MyParkTimeOut, int MyDoorOpenTimeOut)
          Constructor
 
Method Summary
 short decideDirection(boolean[] UpCalls, boolean[] DownCalls)
          Decides the direction in which MyCar should go.
 short getDirection()
          Returns the current Direction
 int getNextStop()
          Returns the next scheduled floor to stop on
 boolean goes(int From, int To, boolean[] UpCalls, boolean[] DownCalls)
          CA
 void issueCommand(int AbsFloor)
          Issues a command to MyCar to floor AbsFloor
 int nextStop(boolean[] UpCalls, boolean[] DownCalls)
          Returns the next scheduled floor to stop on, depending upon the UpCalls and DownCalls
 void tick(boolean[] UpCalls, boolean[] DownCalls)
          This is the tick() that is called by a CA.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOTH_WAY

public static final short BOTH_WAY
Description of the Field

See Also:
Constant Field Values

DOWN_WAY

public static final short DOWN_WAY
Description of the Field

See Also:
Constant Field Values

UP_WAY

public static final short UP_WAY
Description of the Field

See Also:
Constant Field Values

Direction

protected short Direction
DOCUMENT ME!

Constructor Detail

SimpleALLCA

public SimpleALLCA(Car MyCar,
                   int MyParkLevel,
                   int MyParkTimeOut,
                   int MyDoorOpenTimeOut)
Constructor

Parameters:
MyCar - The Car controlled by this SimpleALLCA
MyParkLevel - The level on which MyCar should park
MyParkTimeOut - After this many ticks, SimpleALLCA will park MyCar
MyDoorOpenTimeOut - After this many ticks, SimpleALLCA will close MyCar's door
Method Detail

decideDirection

public short decideDirection(boolean[] UpCalls,
                             boolean[] DownCalls)
Decides the direction in which MyCar should go.

Parameters:
UpCalls - The UP-calls allocated to this SimpleALLCA
DownCalls - The DOWN-calls allocated to this SimpleALLCA
Returns:
The new Direction
Throws:
java.lang.RuntimeException - DOCUMENT ME!

getDirection

public short getDirection()
Returns the current Direction

Returns:
DOCUMENT ME!

getNextStop

public int getNextStop()
Returns the next scheduled floor to stop on

Returns:
DOCUMENT ME!

goes

public boolean goes(int From,
                    int To,
                    boolean[] UpCalls,
                    boolean[] DownCalls)
CA

Parameters:
From - DOCUMENT ME!
To - DOCUMENT ME!
UpCalls - DOCUMENT ME!
DownCalls - DOCUMENT ME!
Returns:
DOCUMENT ME!

issueCommand

public void issueCommand(int AbsFloor)
Issues a command to MyCar to floor AbsFloor

Parameters:
AbsFloor - DOCUMENT ME!

nextStop

public int nextStop(boolean[] UpCalls,
                    boolean[] DownCalls)
Returns the next scheduled floor to stop on, depending upon the UpCalls and DownCalls

Parameters:
UpCalls - DOCUMENT ME!
DownCalls - DOCUMENT ME!
Returns:
DOCUMENT ME!

tick

public void tick(boolean[] UpCalls,
                 boolean[] DownCalls)
This is the tick() that is called by a CA.

Parameters:
UpCalls - The up calls that are planned to be served by this car.
DownCalls - The down calls that are planned to be served by this car.