KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > odmg > Auto


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-2001 by SMB GmbH. All rights reserved.
6
//
7
// $Id: Auto.java,v 1.1 2002/07/29 11:30:22 per_nyfelt Exp $
8

9 package test.odmg;
10
11 import org.ozoneDB.*;
12
13
14 public class Auto extends OzoneObject implements OzoneRemote {
15
16     protected String JavaDoc name = "Ford";
17
18     protected int age = 0;
19
20     protected Auto link;
21
22
23     public Auto( String JavaDoc _name ) throws Exception JavaDoc{
24         name = _name;
25     }
26
27
28     public boolean equals( Object JavaDoc obj ) {
29         Auto auto = (Auto)obj;
30         return name.equals( auto.name() );
31     }
32
33
34     public Auto doSomthing( Auto auto ) throws Exception JavaDoc {
35         System.out.println( "got: " + auto.toString() + " (" + auto.getClass().getName() + ")" );
36         return this;
37     }
38
39
40     public Auto setLink( Auto auto ) throws Exception JavaDoc {
41         // System.out.println ("setLink(): " + auto.toString() + " (" + auto.getClass().getName() + ")");
42
link = auto;
43         return this;
44     }
45
46
47     public void print() {
48         System.out.println( toString() );
49     }
50
51
52     public void setName( String JavaDoc newName ) {
53         name = newName;
54     }
55
56
57     public String JavaDoc name() {
58         return name;
59     }
60
61
62     public void setAge( Integer JavaDoc newAge ) {
63         age = newAge.intValue();
64     // throw new NullPointerException();
65
}
66
67
68     public int setAge( int newAge ) {
69         int ret = age;
70         age = newAge;
71         return age;
72     }
73
74
75     public Integer JavaDoc age() {
76         return new Integer JavaDoc( age );
77     }
78
79
80     public String JavaDoc toString() {
81         // System.out.println ("toString()...");
82
return "Auto:" + name + ", " + String.valueOf( age );
83     }
84
85
86     public void done() throws Exception JavaDoc {
87     // System.out.println (toString() + " done.");
88
}
89
90 }
91
Popular Tags