01: package com.db4o.f1.chapter5;
02:
03: import java.util.*;
04:
05: public class SensorReadout {
06: private Date time;
07: private Car car;
08: private String description;
09: private SensorReadout next;
10:
11: protected SensorReadout(Date time, Car car, String description) {
12: this .time = time;
13: this .car = car;
14: this .description = description;
15: this .next = null;
16: }
17:
18: public Car getCar() {
19: return car;
20: }
21:
22: public Date getTime() {
23: return time;
24: }
25:
26: public String getDescription() {
27: return description;
28: }
29:
30: public SensorReadout getNext() {
31: return next;
32: }
33:
34: public void append(SensorReadout readout) {
35: if (next == null) {
36: next = readout;
37: } else {
38: next.append(readout);
39: }
40: }
41:
42: public int countElements() {
43: return (next == null ? 1 : next.countElements() + 1);
44: }
45:
46: public String toString() {
47: return car + " : " + time + " : " + description;
48: }
49: }
|