becker.xtras.comboLock
Class SampleComboLock

java.lang.Object
  extended by becker.xtras.comboLock.SampleComboLock
All Implemented Interfaces:
IComboLock

public final class SampleComboLock
extends Object

A sample class implementing IComboLock interface. It simulates a combonation lock.

Please see the package description for a more in-depth discussion of using this class.

Author:
Byron Weber Becker

Constructor Summary
SampleComboLock(int num1, int num2, int num3)
           
 
Method Summary
 void addView(IView aView)
          Add a view (graphical user interface) to the lock.
 boolean isLocked()
          Test whether or not the lock is locked.
 void lock()
          Lock the combination lock, assuming it is currently unlocked.
 void unlock(int num1, int num2, int num3)
          Attempt to unlock the combination lock, assuming it is currently locked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleComboLock

public SampleComboLock(int num1,
                       int num2,
                       int num3)
Method Detail

isLocked

public boolean isLocked()
Description copied from interface: IComboLock
Test whether or not the lock is locked.

Specified by:
isLocked in interface IComboLock
Returns:
true if the combination lock is currently locked; false otherwise.

lock

public void lock()
Description copied from interface: IComboLock
Lock the combination lock, assuming it is currently unlocked. If it is already locked, calling this method has no effect.

Specified by:
lock in interface IComboLock

unlock

public void unlock(int num1,
                   int num2,
                   int num3)
Description copied from interface: IComboLock
Attempt to unlock the combination lock, assuming it is currently locked. If the lock is already unlocked, calling this method has no effect.

Specified by:
unlock in interface IComboLock
Parameters:
num1 - The first number in the combination
num2 - The second number in the combination
num3 - The third number in the combination

addView

public void addView(IView aView)
Description copied from interface: IComboLock
Add a view (graphical user interface) to the lock. The view's updateView method must be called each time the lock's state changes.

Specified by:
addView in interface IComboLock