Пример #1
0
 public void
     freeCounter() { // To set the state of the counter - Not an interface method : must be called
                     // internally by other functions
   this.state = CounterState.FREE;
   Log.enter(this.toString() + " is now free");
   element = null;
 }
Пример #2
0
 public void updateState() {
   if (quantity == 0) {
     this.state = CounterState.CLOSED;
     Log.enter(this.toString() + " is now closed");
   }
 }
Пример #3
0
 public void reduceQuantity(int reductionAmount) { // To take away value of amount of goods
   this.quantity -= reductionAmount;
   if (this.quantity < 0) this.quantity = 0;
   Log.enter(
       this.toString() + " has lost " + reductionAmount + " and has only " + quantity + " left");
 }