< prev index next >

src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java

Print this page




  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.corba.se.impl.ior;
  27 
  28 import java.util.Arrays ;
  29 import com.sun.corba.se.spi.ior.ObjectId ;
  30 import org.omg.CORBA_2_3.portable.OutputStream ;
  31 
  32 /**
  33  * @author
  34  */
  35 public final class ObjectIdImpl implements ObjectId
  36 {
  37     private byte[] id;
  38 
  39     public boolean equals( Object obj )
  40     {
  41         if (!(obj instanceof ObjectIdImpl))
  42             return false ;
  43 
  44         ObjectIdImpl other = (ObjectIdImpl)obj ;
  45 
  46         return Arrays.equals( this.id, other.id ) ;
  47     }
  48 
  49     public int hashCode()
  50     {
  51         int result = 17 ;
  52         for (int ctr=0; ctr<id.length; ctr++)
  53             result = 37*result + id[ctr] ;
  54         return result ;


  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.corba.se.impl.ior;
  27 
  28 import java.util.Arrays ;
  29 import com.sun.corba.se.spi.ior.ObjectId ;
  30 import org.omg.CORBA_2_3.portable.OutputStream ;
  31 



  32 public final class ObjectIdImpl implements ObjectId
  33 {
  34     private byte[] id;
  35 
  36     public boolean equals( Object obj )
  37     {
  38         if (!(obj instanceof ObjectIdImpl))
  39             return false ;
  40 
  41         ObjectIdImpl other = (ObjectIdImpl)obj ;
  42 
  43         return Arrays.equals( this.id, other.id ) ;
  44     }
  45 
  46     public int hashCode()
  47     {
  48         int result = 17 ;
  49         for (int ctr=0; ctr<id.length; ctr++)
  50             result = 37*result + id[ctr] ;
  51         return result ;
< prev index next >