01: package com.db4o.f1.chapter3;
02:
03: import java.util.*;
04:
05: public class SensorReadout {
06: private double[] values;
07: private Date time;
08: private Car car;
09:
10: public SensorReadout(double[] values, Date time, Car car) {
11: this .values = values;
12: this .time = time;
13: this .car = car;
14: }
15:
16: public Car getCar() {
17: return car;
18: }
19:
20: public Date getTime() {
21: return time;
22: }
23:
24: public int getNumValues() {
25: return values.length;
26: }
27:
28: public double[] getValues() {
29: return values;
30: }
31:
32: public double getValue(int idx) {
33: return values[idx];
34: }
35:
36: public String toString() {
37: StringBuffer str = new StringBuffer();
38: str.append(car.toString()).append(" : ").append(time.getTime())
39: .append(" : ");
40: for (int idx = 0; idx < values.length; idx++) {
41: if (idx > 0) {
42: str.append(',');
43: }
44: str.append(values[idx]);
45: }
46: return str.toString();
47: }
48: }
|