KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4odoc > f1 > evaluations > SensorReadout


1 package com.db4odoc.f1.evaluations;
2
3 import java.util.*;
4
5 public class SensorReadout {
6     private double[] values;
7     private Date time;
8     private Car car;
9
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 JavaDoc toString() {
37         StringBuffer JavaDoc str=new StringBuffer JavaDoc();
38         str.append(car.toString())
39             .append(" : ")
40             .append(time.getTime())
41             .append(" : ");
42         for(int idx=0;idx<values.length;idx++) {
43             if(idx>0) {
44                 str.append(',');
45             }
46             str.append(values[idx]);
47         }
48         return str.toString();
49     }
50 }
Popular Tags