1 package org.catacomb.interlish.content; 2 3 import org.catacomb.interlish.structure.TouchTime; 4 5 6 public class BasicTouchTime implements TouchTime { 7 8 int touchedAt; 9 static int globalCounter; 10 11 12 static { 13 globalCounter = 1000; 14 } 15 16 17 public BasicTouchTime() { 18 globalCounter += 1; 19 touchedAt = globalCounter; 20 } 21 22 23 public void now() { 24 globalCounter += 1; 25 touchedAt = globalCounter; 26 27 } 28 29 30 public String toString() { 31 return "(touched at " + touchedAt +")"; 32 } 33 34 35 public int time() { 36 return touchedAt; 37 } 38 39 public boolean isAfter(TouchTime ct) { 40 return (touchedAt > ct.time()); 41 } 42 43 public boolean isBefore(TouchTime ct) { 44 return (touchedAt < ct.time()); 45 } 46 47 48 public void never() { 49 touchedAt = 0; 50 } 51 52 }