/[classpath]/classpath/gnu/CORBA/IOR.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/IOR.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.6 by gnu_andrew, Wed Nov 2 00:43:22 2005 UTC revision 1.1.2.7 by gnu_andrew, Sun Nov 27 21:00:36 2005 UTC
# Line 59  import org.omg.IOP.TaggedProfileHelper; Line 59  import org.omg.IOP.TaggedProfileHelper;
59  import java.io.ByteArrayOutputStream;  import java.io.ByteArrayOutputStream;
60  import java.io.IOException;  import java.io.IOException;
61  import java.util.ArrayList;  import java.util.ArrayList;
62    import java.util.Arrays;
63    import java.util.zip.Adler32;
64    
65  /**  /**
66   * The implementaton of the Interoperable Object Reference (IOR). IOR can be   * The implementaton of the Interoperable Object Reference (IOR). IOR can be
# Line 716  public class IOR Line 718  public class IOR
718        // The future supported tagged profiles should be added here.        // The future supported tagged profiles should be added here.
719        throw new BAD_PARAM("Unsupported profile type " + profile.tag);        throw new BAD_PARAM("Unsupported profile type " + profile.tag);
720    }    }
721      
722      /**
723       * Checks for equality.
724       */
725      public boolean equals(Object x)
726      {
727        if (x instanceof IOR)
728          {
729            boolean keys;
730            boolean hosts = true;
731    
732            IOR other = (IOR) x;
733            
734            if (Internet==null || other.Internet==null)
735              return Internet == other.Internet;
736            
737            if (key != null && other.key != null)
738              keys = Arrays.equals(key, other.key);
739            else
740              keys = key == other.key;
741    
742            if (Internet != null && Internet.host != null)
743              if (other.Internet != null && other.Internet.host != null)
744                hosts = other.Internet.host.equals(Internet.host);
745    
746            return keys & hosts && Internet.port==other.Internet.port;
747          }
748        else
749          return false;
750      }
751      
752      /**
753       * Get the hashcode of this IOR.
754       */
755      public int hashCode()
756      {
757        Adler32 adler = new Adler32();
758        if (key != null)
759          adler.update(key);
760        if (Internet != null)
761          {
762            if (Internet.host != null)
763              adler.update(Internet.host.getBytes());
764            adler.update(Internet.port);
765          }
766        return (int) adler.getValue();
767      }
768  }  }

Legend:
Removed from v.1.1.2.6  
changed lines
  Added in v.1.1.2.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26