1 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 clone() { 37 return new DxInteger( value ); 38 } 39 40 41 public boolean equals( Object 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 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 { 76 value = in.readInt(); 77 } 78 } 79 | Popular Tags |