1 17 18 package org.objectweb.jac.aspects.timestamp; 19 20 import java.util.Hashtable ; 21 import java.util.Iterator ; 22 import java.util.Map.Entry; 23 import java.io.File ; 24 25 public class Timestamps { 26 Hashtable stamps = new Hashtable (); 27 28 32 public void touch(Object object) { 33 stamps.put(object,new Long (System.currentTimeMillis())); 34 } 35 36 46 public long getStamp(Object object) { 47 if (object instanceof File ) { 48 return ((File )object).lastModified(); 49 } else { 50 Long stamp = (Long )stamps.get(object); 51 if (stamp!=null) { 52 return stamp.longValue(); 53 } else { 54 return 0; 55 } 56 } 57 } 58 59 62 public void touchAll() { 63 Long time = new Long (System.currentTimeMillis()); 64 Iterator i = stamps.entrySet().iterator(); 65 while (i.hasNext()) { 66 Entry entry = (Entry)i.next(); 67 entry.setValue(time); 68 } 69 } 70 } 71 | Popular Tags |