KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > DxLib > DxInteger


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-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: DxInteger.java,v 1.5 2000/10/28 16:55:14 daniela Exp $
8

9 package org.ozoneDB.DxLib;
10
11 import java.io.*;
12
13
14 public class DxInteger extends DxObject implements Externalizable {
15     
16     final static long serialVersionUID = 1L;
17     
18     int value = 0;
19     
20     
21     public DxInteger() {
22     }
23     
24     
25     public DxInteger( int v ) {
26         value = v;
27     }
28     
29     
30     public DxInteger( DxInteger v ) {
31         super();
32         value = v.value;
33     }
34     
35     
36     public Object JavaDoc clone() {
37         return new DxInteger( value );
38     }
39     
40     
41     public boolean equals( Object JavaDoc obj ) {
42         if (obj instanceof DxInteger && obj != null) {
43             return value == ((DxInteger)obj).value;
44         } else {
45             return false;
46         }
47     }
48     
49     
50     public boolean isLess( DxCompatible obj ) {
51         return value < ((DxInteger)obj).value;
52     }
53     
54     
55     public String JavaDoc toString() {
56         return Integer.toString( value );
57     }
58     
59     
60     public int toInt() {
61         return value;
62     }
63     
64     
65     public int hashCode() {
66         return value;
67     }
68     
69     
70     public void writeExternal( ObjectOutput out ) throws IOException {
71         out.writeInt( value );
72     }
73     
74     
75     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException JavaDoc {
76         value = in.readInt();
77     }
78 }
79
Popular Tags