org.intranet.elevator.model
Class Door

java.lang.Object
  extended byorg.intranet.sim.ModelElement
      extended byorg.intranet.elevator.model.Door

public class Door
extends ModelElement

A door that opens and closes. Valid states:

State Variables Transitions
state open() [OpenEvent] close() [CloseEvent]
CLOSED OPENING Impossible Illegal Impossible
OPENING Illegal opened(): OPENED
[doorOpened()]
Illegal Impossible
OPENED Illegal Impossible close(): CLOSING Impossible
CLOSING OPENING Impossible Illegal closed(): CLOSED
[doorClosed()]


Nested Class Summary
private  class Door.CloseEvent
           
static interface Door.Listener
           
private  class Door.OpenEvent
           
static class Door.State
           
 
Field Summary
private static long CLOSE_TIME
           
private static long CLOSE_WAIT_TIME
           
private  Event event
           
private  Location from
           
private  java.util.List listeners
           
private  int percentClosed
          Varies from 0 to 100.
private  java.util.List priorityListeners
           
private  Door.State state
           
private  Location to
           
 
Fields inherited from class org.intranet.sim.ModelElement
eventQueue
 
Constructor Summary
(package private) Door(EventQueue eQ, Location fromLocation, Location toLocation)
           
 
Method Summary
 void addListener(Door.Listener l, boolean highPriority)
           
(package private)  void close()
           
private  void closed()
           
 Location getFrom()
           
 long getMinimumCycleTime()
           
 int getPercentClosed()
          Returns the percentage the door is closed in its current state.
 Door.State getState()
           
 Location getTo()
           
 boolean isOpen()
           
 void open()
           
private  void opened()
           
 void removeListener(Door.Listener l)
           
private  void setState(Door.State state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

state

private Door.State state

percentClosed

private int percentClosed
Varies from 0 to 100. The door starts closed.


from

private Location from

to

private Location to

listeners

private java.util.List listeners

priorityListeners

private java.util.List priorityListeners

event

private Event event

CLOSE_TIME

private static final long CLOSE_TIME
See Also:
Constant Field Values

CLOSE_WAIT_TIME

private static final long CLOSE_WAIT_TIME
See Also:
Constant Field Values
Constructor Detail

Door

Door(EventQueue eQ,
     Location fromLocation,
     Location toLocation)
Method Detail

getState

public Door.State getState()

setState

private void setState(Door.State state)

getPercentClosed

public int getPercentClosed()
Returns the percentage the door is closed in its current state.

Returns:
An int between 0 and 100.

getFrom

public Location getFrom()

getTo

public Location getTo()

isOpen

public boolean isOpen()

open

public void open()

close

void close()

closed

private void closed()

opened

private void opened()

addListener

public void addListener(Door.Listener l,
                        boolean highPriority)

removeListener

public void removeListener(Door.Listener l)

getMinimumCycleTime

public long getMinimumCycleTime()