CITS2200
Interface Lock


public interface Lock

Interface for a combination lock.


Method Summary
 boolean changeCombo(Combination oldCom, Combination newCom)
           
 boolean close()
          Close the lock.
 boolean open(Combination combo)
          If the combination is correct, open the lock.
 

Method Detail

open

boolean open(Combination combo)
If the combination is correct, open the lock. (If it is already open there is no change.)

Parameters:
combo - the attempted combination
Returns:
true if the combination is correct, false otherwise

close

boolean close()
Close the lock.

Returns:
true

changeCombo

boolean changeCombo(Combination oldCom,
                    Combination newCom)
Parameters:
oldCom - the current combination
newCom - the combination to change to
Returns:
true if the old combination was correct (and hence the combination has been changed to the new one)