1 10 11 package org.netbeans.modules.piagetproject.property; 12 13 17 public class WindowProperty extends Property{ 18 19 long open, active; 20 21 public WindowProperty(String key, String name, String value, String table){ 22 super(key, table); 23 long [] myVal = getWindowTime((String )value); 24 open = myVal [0]; 25 active = myVal [1]; 26 if(name.equals(OUT)){ 27 28 outTotal += myVal[1]; 29 } 30 this.name = name; 31 } 32 33 34 35 private long [] getWindowTime(String time){ 36 String s [] = time.split(" "); 37 long open = Long.parseLong(s[0]); 38 long acti = Long.parseLong(s[1]); 39 return new long[]{open, acti}; 40 } 41 42 public Object getValue(int counter){ 43 double d1 = new Long (open).doubleValue() / counter; 44 double d2 = new Long (active).doubleValue() / counter; 45 46 47 double activeTotal = new Long (ideTotal - outTotal).doubleValue()/counter; 48 d1 /= activeTotal; 49 d2 /= activeTotal; 50 return new double [] {d1, d2}; 51 } 52 53 protected void combineProperties(String key, String value){ 54 long [] next = getWindowTime(value); 55 open += next[0]; 56 active += next[1]; 57 } 58 59 } 60 | Popular Tags |