KickJava   Java API By Example, From Geeks To Geeks.

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


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: DxLong.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 DxLong extends DxObject implements Externalizable {
15     
16     final static long serialVersionUID = 1L;
17     
18     long value = 0;
19     
20     
21     public DxLong() {
22     }
23     
24     
25     public DxLong( long v ) {
26         value = v;
27     }
28     
29     
30     public DxLong( DxLong v ) {
31         super();
32         value = v.value;
33     }
34     
35     
36     public Object JavaDoc clone() {
37         return new DxLong( value );
38     }
39     
40     
41     public boolean equals( Object JavaDoc obj ) {
42         return value == ((DxLong)obj).value;
43     }
44     
45     
46     public boolean isLess( DxCompatible obj ) {
47         return value < ((DxLong)obj).value;
48     }
49     
50     
51     public String JavaDoc toString() {
52         return Long.toString( value );
53     }
54     
55     
56     public long toLong() {
57         return value;
58     }
59     
60     
61     public int hashCode() {
62         //die fehlenden bits dann mit equals()
63
return (int)value;
64     }
65     
66     
67     public void writeExternal( ObjectOutput out ) throws IOException {
68         out.writeLong( value );
69     }
70     
71     
72     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException JavaDoc {
73         value = in.readLong();
74     }
75 }
76
Popular Tags