nus/ShopCounter.java
YADUNAND PREM ae8e984866 Finished Lab2
fix: update test.sh

feat: reformat and remote BaseShopEvent

chore: add comments
2022-11-08 18:03:35 +08:00

37 lines
628 B
Java

/**
* This is a data class which holds information about a counter. It has a
* incrementing counter for the conuter Id.
*
* @author Yadunand Prem
* @version CS2030S AY22/23 Semester 2
*/
public class ShopCounter {
private static int lastId;
private final int id;
private boolean available;
public boolean isAvailable() {
return available;
}
public void occupy() {
this.available = false;
}
public void free() {
this.available = true;
}
public ShopCounter() {
this.id = lastId++;
this.available = true;
}
@Override
public String toString() {
return "S" + id;
}
}