public class Press implements AtomicModel<Integer, Integer> {
  private int p = 0;
  private double s = 0;

  public Integer lambda() {
    return 1;
  }

  public void deltaInt() {
    p--;
    s = 1;
  }

  public void deltaExt(Integer input, double elapsed) {
    if (p > 0) {
      p += input;
      s -= elapsed;
    } else {
      p = input;
      s = 1;
    }
  }

  public void deltaCon(Integer input) {
    p = p + input - 1;
    s = 1;
  }

  public double timeAdvance() {
    return (p > 0) ? s: Double.POSITIVE_INFINITY;
  }
}
