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-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: DxBoolean.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
08:
09: package org.ozoneDB.DxLib;
10:
11: import java.io.*;
12:
13: public class DxBoolean extends DxObject implements Externalizable {
14: boolean value;
15:
16: final static long serialVersionUID = 1L;
17:
18: public DxBoolean() {
19: value = false;
20: }
21:
22: public DxBoolean(boolean v) {
23: value = v;
24: }
25:
26: public DxBoolean(DxBoolean v) {
27: super ();
28: value = v.value;
29: }
30:
31: public Object clone() {
32: return new DxBoolean(value);
33: }
34:
35: public boolean equals(Object obj) {
36: if (obj instanceof DxBoolean && obj != null) {
37: if (this == obj) {
38: return true;
39: }
40: return value == ((DxBoolean) obj).value;
41: }
42: return false;
43: }
44:
45: public boolean isLess(DxCompatible obj) {
46: if (obj.getClass().equals(getClass())) {
47: if (this == obj) {
48: return false;
49: }
50: // false ist kleiner als true
51: return !value && ((DxBoolean) obj).value;
52: }
53: return false;
54: }
55:
56: public String toString() {
57: Boolean b = new Boolean(value);
58: return b.toString();
59: }
60:
61: public boolean toBoolean() {
62: return value;
63: }
64:
65: public int hashCode() {
66: Boolean b = new Boolean(value);
67: return b.hashCode();
68: }
69:
70: public void writeExternal(ObjectOutput out) throws IOException {
71: out.writeBoolean(value);
72: }
73:
74: public void readExternal(ObjectInput in) throws IOException,
75: ClassNotFoundException {
76: value = in.readBoolean();
77: }
78: }
|