Methods Summary |
---|
private void | checkAccess(java.lang.String clientIDNumber)
if (null == _currentClient) {
_currentClient = clientIDNumber;
} else {
if (!_currentClient.equals(clientIDNumber)) {
throw new LockedAccountException();
}
}
resetCounter();
return;
|
private void | checkForNegativeAmount(Money amount)
int cents = amount.getCents();
if (0 > cents) {
throw new NegativeAmountException();
}
|
private void | checkForOverdraft(Money amount)
if (amount.greaterThan(_balance)) {
throw new OverdraftException(false);
}
return;
|
protected synchronized void | decrementLockTimer(int amountToDecrement)
_timeLeftUntilLockIsReleased -= amountToDecrement;
if (_timeLeftUntilLockIsReleased < 0) {
_currentClient = null;
}
|
public synchronized Money | getBalance(java.lang.String clientIDNumber)
checkAccess(clientIDNumber);
return _balance;
|
public synchronized void | makeDeposit(java.lang.String clientIDNumber, Money amount)
checkAccess(clientIDNumber);
checkForNegativeAmount(amount);
_balance = _balance.add(amount);
return;
|
public synchronized void | makeWithdrawal(java.lang.String clientIDNumber, Money amount)
checkAccess(clientIDNumber);
checkForNegativeAmount(amount);
checkForOverdraft(amount);
_balance = _balance.subtract(amount);
return;
|
private void | resetCounter()
_timeLeftUntilLockIsReleased = TIMER_DURATION;
|
private java.lang.String | wrapperAroundGetClientHost()
String clientHost = null;
try {
clientHost = getClientHost();
} catch (ServerNotActiveException ignored) {
}
return clientHost;
|