KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > f1 > chapter5 > SensorReadout


1 package com.db4o.f1.chapter5;
2
3 import java.util.*;
4
5 public class SensorReadout {
6     private Date time;
7     private Car car;
8     private String JavaDoc description;
9     private SensorReadout next;
10
11     protected SensorReadout(Date time,Car car,String JavaDoc 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 JavaDoc 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         }
38         else {
39             next.append(readout);
40         }
41     }
42     
43     public int countElements() {
44         return (next==null ? 1 : next.countElements()+1);
45     }
46     
47     public String JavaDoc toString() {
48         return car+" : "+time+" : "+description;
49     }
50 }
Popular Tags