diff options
author | Michael Koch <konqueror@gmx.de> | 2003-03-31 06:32:37 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-03-31 06:32:37 +0000 |
commit | 60c98fd6115a55ff13c492d2b022925bc3f80111 (patch) | |
tree | fa831270c85982f422006a91567c687feca02603 /libjava/java/rmi/dgc/VMID.java | |
parent | 2ce0d0b097225538935a0ac9e1b713c024183547 (diff) | |
download | gcc-60c98fd6115a55ff13c492d2b022925bc3f80111.zip gcc-60c98fd6115a55ff13c492d2b022925bc3f80111.tar.gz gcc-60c98fd6115a55ff13c492d2b022925bc3f80111.tar.bz2 |
VMID.java, [...]: Reformatted.
2003-03-31 Michael Koch <konqueror@gmx.de>
* java/rmi/dgc/VMID.java,
java/rmi/registry/RegistryHandler.java,
java/rmi/server/LogStream.java,
java/rmi/server/Operation.java,
java/rmi/server/RemoteCall.java,
java/rmi/server/RemoteRef.java,
java/rmi/server/RemoteStub.java:
Reformatted.
From-SVN: r65078
Diffstat (limited to 'libjava/java/rmi/dgc/VMID.java')
-rw-r--r-- | libjava/java/rmi/dgc/VMID.java | 163 |
1 files changed, 91 insertions, 72 deletions
diff --git a/libjava/java/rmi/dgc/VMID.java b/libjava/java/rmi/dgc/VMID.java index 408f365..c7946cd 100644 --- a/libjava/java/rmi/dgc/VMID.java +++ b/libjava/java/rmi/dgc/VMID.java @@ -38,79 +38,98 @@ exception statement from your version. */ package java.rmi.dgc; import java.io.Serializable; -import java.rmi.server.UID; import java.net.InetAddress; import java.net.UnknownHostException; +import java.rmi.server.UID; -public final class VMID - implements Serializable { - -static final long serialVersionUID = -538642295484486218L; -static final boolean areWeUnique; -static byte[] localAddr; - -private byte[] addr; -private UID uid; - -static { - byte[] addr; - boolean awu = true; - try { - addr = InetAddress.getLocalHost().getAddress(); - if (addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) { - awu = false; - } - } - catch (UnknownHostException _) { - addr = new byte[]{ 127, 0, 0, 1 }; - awu = false; - } - localAddr = addr; - areWeUnique = awu; -} - -public VMID() { - addr = localAddr; - uid = new UID(); -} - -public static boolean isUnique() { - return (areWeUnique); -} - -public int hashCode() { - return (super.hashCode()); -} - -public boolean equals(Object obj) { - if (!(obj instanceof VMID)) { - return (false); - } - VMID other = (VMID)obj; - if (addr.length != other.addr.length) { - return (false); - } - for (int i = addr.length - 1; i >= 0; i--) { - if (addr[i] != other.addr[i]) { - return (false); - } - } - return (uid.equals(other.uid)); -} - -public String toString() { - StringBuffer buf = new StringBuffer("[VMID: "); - for (int i = 0; i < addr.length; i++) { - if (i > 0) { - buf.append("."); - } - buf.append(Integer.toString(addr[i])); - } - buf.append(" "); - buf.append(uid.toString()); - buf.append("]"); - - return (buf.toString()); -} - +public final class VMID implements Serializable +{ + static final long serialVersionUID = -538642295484486218L; + + static final boolean areWeUnique; + + static byte[] localAddr; + + private byte[] addr; + + private UID uid; + + static + { + byte[] addr; + boolean awu = true; + try { + addr = InetAddress.getLocalHost().getAddress(); + if (addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) { + awu = false; + } + } + catch (UnknownHostException _) { + addr = new byte[]{ 127, 0, 0, 1 }; + awu = false; + } + localAddr = addr; + areWeUnique = awu; + } + + public VMID() + { + addr = localAddr; + uid = new UID(); + } + + public static boolean isUnique () + { + return areWeUnique; + } + + public int hashCode () + { + return super.hashCode(); + } + + public boolean equals (Object obj) + { + if (!(obj instanceof VMID)) + { + return false; + } + + VMID other = (VMID) obj; + if (addr.length != other.addr.length) + { + return false; + } + + for (int i = addr.length - 1; i >= 0; i--) + { + if (addr[i] != other.addr[i]) + { + return false; + } + } + + return uid.equals(other.uid); + } + + public String toString () + { + StringBuffer buf = new StringBuffer ("[VMID: "); + + for (int i = 0; i < addr.length; i++) + { + if (i > 0) + { + buf.append ("."); + } + + buf.append (Integer.toString (addr [i])); + } + + buf.append (" "); + buf.append (uid.toString ()); + buf.append ("]"); + + return buf.toString(); + } } |