    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class atm.ATM

    java.lang.Object
       |
       +----atm.ATM

public class ATM
extends Object
implements Runnable

Representation for the ATM itself. An object of this class "owns" the objects representing the component parts of the ATM, and the communications network, and is responsible for creating customer sessions which then use it to gain access to the component parts. This is an active class - when an instance of the class is created, a thread is executed that actually runs the system.

##

bankAddress
  Internet address of the bank
bankName
  Name of the bank owning this ATM
cardInserted
  Becomes true when the card reader informs the ATM that a card has been inserted - the ATM will make this false when it has tried to read the card
cardReader
  The ATM's card reader
cashDispenser
  The ATM's cash dispenser
customerConsole
  The ATM's customer console
envelopeAcceptor
  The ATM's envelope acceptor
id
  Unique ID for this ATM
IDLE_STATE
  The ATM is on, but idle.
log
  The ATM's log
networkToBank
  The ATM's network connection to the bank
OFF_STATE
  The ATM is off.
operatorPanel
  The ATM's operator panel
place
  Physical location of this ATM
receiptPrinter
  The ATM's receipt printer
SERVING_CUSTOMER_STATE
  The ATM is servicing a customer.
state
  The current state of the ATM - one of the possible values listed below
switchOn
  Becomes true when the operator panel informs the ATM that the switch has been turned on - becomes false when the operator panel informs the ATM that the switch has been turned off.

##

ATM(int, String, String, InetAddress)
  Constructor

##

cardInserted()
  Inform the ATM that a card has been inserted into the card reader.
getBankName()
  Accessor for bank name
getCardReader()
  Accessor for card reader
getCashDispenser()
  Accessor for cash dispenser
getCustomerConsole()
  Accessor for customer console
getEnvelopeAcceptor()
  Accessor for envelope acceptor
getID()
  Accessor for id
getLog()
  Accessor for log
getNetworkToBank()
  Accessor for network to bank
getOperatorPanel()
  Accessor for operator panel
getPlace()
  Accessor for place
getReceiptPrinter()
  Accessor for receipt printer
performShutdown()
  Perform the System Shutdown use case when switch is turned off
performStartup()
  Perform the System Startup use case when switch is turned on
run()
  The main program/applet will create a Thread that executes this code.
switchOff()
  Inform the ATM that the switch on the operator console has been moved to the "off" position.
switchOn()
  Inform the ATM that the switch on the operator console has been moved to the "on" position.

##

id

     private int id

  Unique ID for this ATM

place

     private String place

  Physical location of this ATM

bankName

     private String bankName

  Name of the bank owning this ATM

bankAddress

     private InetAddress bankAddress

  Internet address of the bank

cardReader

     private CardReader cardReader

  The ATM's card reader

cashDispenser

     private CashDispenser cashDispenser

  The ATM's cash dispenser

customerConsole

     private CustomerConsole customerConsole

  The ATM's customer console

envelopeAcceptor

     private EnvelopeAcceptor envelopeAcceptor

  The ATM's envelope acceptor

log

     private Log log

  The ATM's log

networkToBank

     private NetworkToBank networkToBank

  The ATM's network connection to the bank

operatorPanel

     private OperatorPanel operatorPanel

  The ATM's operator panel

receiptPrinter

     private ReceiptPrinter receiptPrinter

  The ATM's receipt printer

state

     private int state

  The current state of the ATM - one of the possible values listed below

switchOn

     private boolean switchOn

  Becomes true when the operator panel informs the ATM that the switch has been turned on - becomes false when the operator panel informs the ATM that the switch has been turned off.

cardInserted

     private boolean cardInserted

  Becomes true when the card reader informs the ATM that a card has been inserted - the ATM will make this false when it has tried to read the card

OFF_STATE

     private static final int OFF_STATE

  The ATM is off. The switch must be turned on before it can operate

IDLE_STATE

     private static final int IDLE_STATE

  The ATM is on, but idle. It can service a customer, or it can be shut down

SERVING_CUSTOMER_STATE

     private static final int SERVING_CUSTOMER_STATE

  The ATM is servicing a customer.

##

ATM

     public ATM(int id,
                String place,
                String bankName,
                InetAddress bankAddress)

  Constructor

  Parameters:
    id - the unique ID for this ATM
    place - the physical location of this ATM
    bankName - the name of the bank owning this ATM
    bankAddress - the Internet address of the bank

##

run

     public void run()

  The main program/applet will create a Thread that executes this code.

switchOn

     public synchronized void switchOn()

  Inform the ATM that the switch on the operator console has been moved to the "on" position.

switchOff

     public synchronized void switchOff()

  Inform the ATM that the switch on the operator console has been moved to the "off" position.

cardInserted

     public synchronized void cardInserted()

  Inform the ATM that a card has been inserted into the card reader.

getID

     public int getID()

  Accessor for id

  Returns:
    unique id of this ATM

getPlace

     public String getPlace()

  Accessor for place

  Returns:
    physical location of this ATM

getBankName

     public String getBankName()

  Accessor for bank name

  Returns:
    name of bank owning this ATM

getCardReader

     public CardReader getCardReader()

  Accessor for card reader

  Returns:
    card reader component of this ATM

getCashDispenser

     public CashDispenser getCashDispenser()

  Accessor for cash dispenser

  Returns:
    cash dispenser component of this ATM

getCustomerConsole

     public CustomerConsole getCustomerConsole()

  Accessor for customer console

  Returns:
    customer console component of this ATM

getEnvelopeAcceptor

     public EnvelopeAcceptor getEnvelopeAcceptor()

  Accessor for envelope acceptor

  Returns:
    envelope acceptor component of this ATM

getLog

     public Log getLog()

  Accessor for log

  Returns:
    log component of this ATM

getNetworkToBank

     public NetworkToBank getNetworkToBank()

  Accessor for network to bank

  Returns:
    network connection to bank of this ATM

getOperatorPanel

     public OperatorPanel getOperatorPanel()

  Accessor for operator panel

  Returns:
    operator panel component of this ATM

getReceiptPrinter

     public ReceiptPrinter getReceiptPrinter()

  Accessor for receipt printer

  Returns:
    receipt printer component of this ATM

performStartup

     private void performStartup()

  Perform the System Startup use case when switch is turned on

performShutdown

     private void performShutdown()

  Perform the System Shutdown use case when switch is turned off

    All Packages  Class Hierarchy  This Package  Previous  Next  Index