01: /*
02: Copyright (C) 2007 Mobixess Inc. http://www.java-objects-database.com
03:
04: This file is part of the JODB (Java Objects Database) open source project.
05:
06: JODB is free software; you can redistribute it and/or modify it under
07: the terms of version 2 of the GNU General Public License as published
08: by the Free Software Foundation.
09:
10: JODB is distributed in the hope that it will be useful, but WITHOUT ANY
11: WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: for more details.
14:
15: You should have received a copy of the GNU General Public License along
16: with this program; if not, write to the Free Software Foundation, Inc.,
17: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: */
19: package com.mobixess.jodb.tests.testobjects;
20:
21: public class ObjectA {
22:
23: private byte _val1;
24: private short _val2;
25: private ObjectB _val3;
26: private static int _hash;
27:
28: /**
29: * @param val1
30: * @param val2
31: * @param val3
32: */
33: public ObjectA(byte val1, short val2, ObjectB val3) {
34: super ();
35: _hash++;
36: _val1 = val1;
37: _val2 = val2;
38: _val3 = val3;
39: }
40:
41: public byte getVal1() {
42: return _val1;
43: }
44:
45: public void setVal1(byte val1) {
46: _val1 = val1;
47: }
48:
49: public short getVal2() {
50: return _val2;
51: }
52:
53: public void setVal2(short val2) {
54: _val2 = val2;
55: }
56:
57: public ObjectB getVal3() {
58: return _val3;
59: }
60:
61: public void setVal3(ObjectB val3) {
62: _val3 = val3;
63: }
64:
65: @Override
66: public boolean equals(Object obj) {
67: if (!(obj instanceof ObjectA)) {
68: return false;
69: }
70: ObjectA obj1 = (ObjectA) obj;
71: return obj1._val1 == _val1 && obj1._val2 == _val2;
72: }
73:
74: @Override
75: public String toString() {
76: return super .toString() + " " + _val1 + " " + _val2;
77: }
78:
79: // @Override
80: // public int hashCode()
81: // {
82: // return _hash;
83: // }
84: }
|