01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-2001 by SMB GmbH. All rights reserved.
06: //
07: // $Id: Auto.java,v 1.1 2002/07/29 11:30:22 per_nyfelt Exp $
08:
09: package test.odmg;
10:
11: import org.ozoneDB.*;
12:
13: public class Auto extends OzoneObject {
14:
15: protected String name = "Ford";
16:
17: protected int age = 0;
18:
19: protected Auto link;
20:
21: public Auto(String _name) throws Exception {
22: name = _name;
23: }
24:
25: public boolean equals(Object obj) {
26: Auto auto = (Auto) obj;
27: return name.equals(auto.name());
28: }
29:
30: public Auto doSomthing(Auto auto) throws Exception {
31: System.out.println("got: " + auto.toString() + " ("
32: + auto.getClass().getName() + ")");
33: return this ;
34: }
35:
36: public Auto setLink(Auto auto) throws Exception {
37: // System.out.println ("setLink(): " + auto.toString() + " (" + auto.getClass().getName() + ")");
38: link = auto;
39: return this ;
40: }
41:
42: public void print() {
43: System.out.println(toString());
44: }
45:
46: public void setName(String newName) {
47: name = newName;
48: }
49:
50: public String name() {
51: return name;
52: }
53:
54: public void setAge(Integer newAge) {
55: age = newAge.intValue();
56: // throw new NullPointerException();
57: }
58:
59: public int setAge(int newAge) {
60: int ret = age;
61: age = newAge;
62: return age;
63: }
64:
65: public Integer age() {
66: return new Integer(age);
67: }
68:
69: public String toString() {
70: // System.out.println ("toString()...");
71: return "Auto:" + name + ", " + String.valueOf(age);
72: }
73:
74: public void done() throws Exception {
75: // System.out.println (toString() + " done.");
76: }
77:
78: }
|