1 10 11 package org.netbeans.modules.piagetproject.property; 12 13 17 public class LongProperty extends Property{ 18 19 long value; 20 21 22 public LongProperty(String key, String name, String value, String table) { 23 super(key, table, name); 24 this.value = Long.parseLong(value); 25 } 26 27 public Object getValue(int counter) { 28 long average = value / counter; 29 return prettyTime(average); 30 } 31 32 protected void combineProperties(String key, String value) { 33 long l = Long.parseLong(value); 34 this.value += l; 35 } 36 37 private static String prettyTime(long l){ 38 int i = new Long (l/1000).intValue(); 39 int h = i/3600; 40 String hs = new Integer (h).toString(); 41 if(h<10) hs = "0"+hs; 42 int m = (i%3600)/60; 43 String ms = new Integer (m).toString(); 44 if(m<10) ms = "0"+ms; 45 int s = i%60; 46 String ss = new Integer (s).toString(); 47 if(s<10) ss = "0"+ss; 48 return hs+":"+ms+":"+ss; 49 } 50 51 } 52 | Popular Tags |