1 25 26 package org.jrobin.core; 27 28 39 public class FetchPoint { 40 41 private long time; 42 private double[] values; 43 44 FetchPoint(long time, int size) { 45 this.time = time; 46 values = new double[size]; 47 for(int i = 0; i < size; i++) { 48 values[i] = Double.NaN; 49 } 50 } 51 52 56 public long getTime() { 57 return time; 58 } 59 60 66 public double[] getValues() { 67 return values; 68 } 69 70 74 public int getSize() { 75 return values.length; 76 } 77 78 84 public double getValue(int i) { 85 return values[i]; 86 } 87 88 void setValue(int index, double value) { 89 values[index] = value; 90 } 91 92 96 public String dump() { 97 StringBuffer buffer = new StringBuffer (time + ": "); 98 for(int i = 0; i < values.length; i++) { 99 buffer.append(Util.formatDouble(values[i], true)); 100 buffer.append(" "); 101 } 102 return buffer.toString(); 103 } 104 105 109 public String toString() { 110 return dump(); 111 } 112 } 113 | Popular Tags |