@Test public void testForZero() throws Exception { if (! "/".equals(File.separator)) { return; } SlotMapper mapper = new SlotMapper(); assertEquals("1970/01/01/"+SERVICENAME+"_1970-01-01_00", mapper.map(0L, SERVICENAME)); }
public String map(long time, String service) { if (time < 0) { throw new IllegalArgumentException("Timestamp was less than zero"); } long slotnum = time / SLOT_LENGTH; String slot = slotCache.get(slotnum); if (null == slot) { if (slotCache.size() > LARGE_CACHE) { slotCache.clear(); } slot = mapToPath(time, service); slotCache.put(slotnum, slot); } return slot; }
SlotMapper { public String map(long time, String service) { if (time < 0) { throw new IllegalArgumentException("Timestamp was less than zero"); } long slotnum = time / SLOT_LENGTH; String slot = slotCache.get(slotnum); if (null == slot) { if (slotCache.size() > LARGE_CACHE) { slotCache.clear(); } slot = mapToPath(time, service); slotCache.put(slotnum, slot); } return slot; } }
SlotMapper { public String map(long time, String service) { if (time < 0) { throw new IllegalArgumentException("Timestamp was less than zero"); } long slotnum = time / SLOT_LENGTH; String slot = slotCache.get(slotnum); if (null == slot) { if (slotCache.size() > LARGE_CACHE) { slotCache.clear(); } slot = mapToPath(time, service); slotCache.put(slotnum, slot); } return slot; }  }
SlotMapper { public String map(long time, String service) { if (time < 0) { throw new IllegalArgumentException("Timestamp was less than zero"); } long slotnum = time / SLOT_LENGTH; String slot = slotCache.get(slotnum); if (null == slot) { if (slotCache.size() > LARGE_CACHE) { slotCache.clear(); } slot = mapToPath(time, service); slotCache.put(slotnum, slot); } return slot; }  String map(long time, String service); static String mapToPath(long time, String service); }
SlotMapper { public String map(long time, String service) { if (time < 0) { throw new IllegalArgumentException("Timestamp was less than zero"); } long slotnum = time / SLOT_LENGTH; String slot = slotCache.get(slotnum); if (null == slot) { if (slotCache.size() > LARGE_CACHE) { slotCache.clear(); } slot = mapToPath(time, service); slotCache.put(slotnum, slot); } return slot; }  String map(long time, String service); static String mapToPath(long time, String service); static final TimeZone TZ; static final long SLOT_LENGTH; static final int LARGE_CACHE; }