Ejemplo n.º 1
0
 public void resume() {
   switch (status) {
     case PAUSED:
       long now = now();
       global.resume(now);
       for (TimeEntry entry : splitStack) {
         entry.resume(now);
       }
       status = Status.RUN;
       break;
     case RUN:
       // no-op;
       break;
     default:
       throw new IllegalArgumentException("unknow status: " + status);
   }
 }
Ejemplo n.º 2
0
 public void split(String name) {
   TimeEntry entry = new TimeEntry();
   entry.name = name;
   if (!splitNameCache.contains(name)) {
     splitNameCache.add(name);
   }
   switch (status) {
     case PAUSED:
       entry.reset();
       splitStack.add(entry);
       break;
     case RUN:
       splitStack.add(entry);
       // set time later
       entry.resume(now());
       break;
     default:
       throw new IllegalArgumentException("unknow status: " + status);
   }
 }