package utils;

public class Counter {
  int alarm;
  int count=0;
  public Counter() { alarm=3; } // by default, counters count to 3
  public Counter(int t) { alarm=t; }
  public void tick() { if(count<alarm) count++; }
  public boolean expired() { return (count>=alarm); }
  public void reset() { count=0; }
  public void set(int n) { count=n; }
  public int get() { return count; }
  public void setAlarm(int t) { alarm=t; }
  public int getAlarm() { return alarm; }
  public String toString() { return count+"/"+alarm; }
  public Object clone() {
    Counter c = new Counter(alarm); c.set(count); return c;
  }
}
