1 7 8 package com.sun.corba.se.impl.orb ; 9 10 import org.omg.CORBA.portable.OutputStream ; 11 12 import com.sun.corba.se.spi.orb.ORBVersion ; 13 14 public class ORBVersionImpl implements ORBVersion { 15 private byte orbType ; 16 17 public ORBVersionImpl( byte orbType ) 18 { 19 this.orbType = orbType ; 20 } 21 22 public static final ORBVersion FOREIGN = new ORBVersionImpl( 23 ORBVersion.FOREIGN ) ; 24 25 public static final ORBVersion OLD = new ORBVersionImpl( 26 ORBVersion.OLD ) ; 27 28 public static final ORBVersion NEW = new ORBVersionImpl( 29 ORBVersion.NEW ) ; 30 31 public static final ORBVersion JDK1_3_1_01 = new ORBVersionImpl( 32 ORBVersion.JDK1_3_1_01 ) ; 33 34 public static final ORBVersion NEWER = new ORBVersionImpl( 35 ORBVersion.NEWER ) ; 36 37 public static final ORBVersion PEORB = new ORBVersionImpl( 38 ORBVersion.PEORB ) ; 39 40 public byte getORBType() 41 { 42 return orbType ; 43 } 44 45 public void write( OutputStream os ) 46 { 47 os.write_octet( (byte)orbType ) ; 48 } 49 50 public String toString() 51 { 52 return "ORBVersionImpl[" + Byte.toString( orbType ) + "]" ; 53 } 54 55 public boolean equals( Object obj ) 56 { 57 if (!(obj instanceof ORBVersion)) 58 return false ; 59 60 ORBVersion version = (ORBVersion)obj ; 61 return version.getORBType() == orbType ; 62 } 63 64 public int hashCode() 65 { 66 return orbType ; 67 } 68 69 public boolean lessThan(ORBVersion version) { 70 return orbType < version.getORBType(); 71 } 72 73 public int compareTo(Object obj) { 74 return getORBType() - ((ORBVersion)obj).getORBType(); 79 } 80 } 81 | Popular Tags |