harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r407724 [11/11] - in /incubator/harmony/enhanced/classlib/trunk: make/ modules/rmi/make/ modules/rmi/src/main/java/java/rmi/ modules/rmi/src/main/java/java/rmi/registry/ modules/rmi/src/main/java/java/rmi/server/ modules/rmi/src/main/java/o...
Date Fri, 19 May 2006 06:00:56 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/transport/jrmp/ServerProtocolHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/transport/jrmp/ServerProtocolHandler.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/transport/jrmp/ServerProtocolHandler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/transport/jrmp/ServerProtocolHandler.java Thu May 18 23:00:52 2006
@@ -1,159 +1,159 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.transport.jrmp;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.rmi.UnmarshalException;
-
-import ar.org.fitc.rmi.transport.EndpointID;
-import ar.org.fitc.rmi.transport.ProtocolException;
-
-/**
- * Implements the Server side management of the messages of the JRMP protocol.
- * 
- * @author Gustavo Petri
- */
-public final class ServerProtocolHandler {
-
-	/**
-	 * The client endpoint of the connection.
-	 */
-	private EndpointID clientEP;
-
-	/**
-	 * The local {@link java.io.InputStream} to interact with the client
-	 */
-	private DataInputStream in;
-
-	/**
-	 * The local {@link java.io.OutputStream} to interact with the client.
-	 */
-	private DataOutputStream out;
-
-	/**
-	 * The {@link ProtocolType} which identifies the type of the connection
-	 */
-	private ProtocolType protocolType;
-
-	/**
-	 * Constructs a new {@link ServerProtocolHandler}
-	 * 
-	 * @param in
-	 *            the {@link ar.org.fitc.rmi.transport.RMIObjectInputStream}
-	 * @param out
-	 *            the {@link ar.org.fitc.rmi.transport.RMIObjectInputStream}
-	 * @param clientEP
-	 *            the client {@link EndpointID}
-	 */
-	public ServerProtocolHandler(DataInputStream in, DataOutputStream out,
-			EndpointID clientEP) {
-
-		this.out = out;
-		this.in = in;
-		this.clientEP = (clientEP == null) ? new EndpointID() : clientEP;
-	}
-
-	/**
-	 * Writes the JRMP handshake answer to the client.
-	 * 
-	 * @throws ProtocolException
-	 *             if an exception occurs writing the hanshake data to the
-	 *             client.
-	 */
-	public final void answerHandshake() throws ProtocolException {
-
-		try {
-			if (protocolType == ProtocolType.STREAM) {
-				out.writeByte(HeaderResponse.PROTOCOL_ACK.getValue());
-				clientEP.write(out);
-			} else if (protocolType == ProtocolType.SINGLE_OP) {
-				out.writeByte(HeaderResponse.PROTOCOL_ACK.getValue());
-			} else {
-				out.writeByte(HeaderResponse.PROTOCOL_NOT_SUPPORTED.getValue());
-			}
-		} catch (IOException e) {
-			throw new ProtocolException("Error sending Protocol answer");
-		}
-	}
-
-	/**
-	 * Reads the default client's Endpoint used to accept calls.
-	 * 
-	 * @return an {@link ar.org.fitc.rmi.transport.EndpointID}
-	 */
-	public final EndpointID readEndpointNegotiation() {
-		EndpointID defaultEP = null;
-		try {
-			defaultEP = EndpointID.read(in);
-		} catch (IOException e) {
-			new ProtocolException("Exception reading EndpointID", e);
-		}
-		return defaultEP;
-	}
-
-	/**
-	 * Reads the initial handshake sequence sent by the client.
-	 * 
-	 * @param type
-	 *            a {@link ProtocolType} object indicating the protocol type
-	 * @throws ProtocolException
-	 *             if an exception occurs while reading the handshake data from
-	 *             the imput stream
-	 */
-	public final void readHandShake(ProtocolType type) throws ProtocolException {
-		Header header = new Header(type);
-		try {
-			header.readExternal(in);
-			protocolType = header.getProtocolType();
-		} catch (IOException e) {
-			throw new ProtocolException("I/O Error Reading Transport Header", e);
-		}
-	}
-
-	/**
-	 * Reads a {@link Message} object from the connection's input stream.
-	 * 
-	 * @return the {@link Message} object read.
-	 * @throws UnmarshalException
-	 *             if an exception occurs reading the input stream.
-	 */
-	public final Message readMessage() throws UnmarshalException {
-		Message msg = new Message();
-		try {
-			msg.readExternal(in);
-		} catch (IOException e) {
-			throw new UnmarshalException("IO error unmarshaling a message", e);
-		}
-		return msg;
-	}
-
-	/**
-	 * Writes a {@link MessageResponse#PING_ACK} into the ouput stream.
-	 * 
-	 * @throws ProtocolException
-	 *             if there is an error in the underlying protocol
-	 */
-	public final void writePingAck() throws ProtocolException {
-		try {
-			out.writeByte(MessageResponse.PING_ACK.getValue());
-		} catch (IOException e) {
-			throw new ProtocolException("I/O Error Marshaling a ProtocolAck", e);
-		}
-	}
-
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.transport.jrmp;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.rmi.UnmarshalException;
+
+import org.apache.harmony.rmi.internal.transport.EndpointID;
+import org.apache.harmony.rmi.internal.transport.ProtocolException;
+
+/**
+ * Implements the Server side management of the messages of the JRMP protocol.
+ * 
+ * @author Gustavo Petri
+ */
+public final class ServerProtocolHandler {
+
+	/**
+	 * The client endpoint of the connection.
+	 */
+	private EndpointID clientEP;
+
+	/**
+	 * The local {@link java.io.InputStream} to interact with the client
+	 */
+	private DataInputStream in;
+
+	/**
+	 * The local {@link java.io.OutputStream} to interact with the client.
+	 */
+	private DataOutputStream out;
+
+	/**
+	 * The {@link ProtocolType} which identifies the type of the connection
+	 */
+	private ProtocolType protocolType;
+
+	/**
+	 * Constructs a new {@link ServerProtocolHandler}
+	 * 
+	 * @param in
+	 *            the {@link org.apache.harmony.rmi.internal.transport.RMIObjectInputStream}
+	 * @param out
+	 *            the {@link org.apache.harmony.rmi.internal.transport.RMIObjectInputStream}
+	 * @param clientEP
+	 *            the client {@link EndpointID}
+	 */
+	public ServerProtocolHandler(DataInputStream in, DataOutputStream out,
+			EndpointID clientEP) {
+
+		this.out = out;
+		this.in = in;
+		this.clientEP = (clientEP == null) ? new EndpointID() : clientEP;
+	}
+
+	/**
+	 * Writes the JRMP handshake answer to the client.
+	 * 
+	 * @throws ProtocolException
+	 *             if an exception occurs writing the hanshake data to the
+	 *             client.
+	 */
+	public final void answerHandshake() throws ProtocolException {
+
+		try {
+			if (protocolType == ProtocolType.STREAM) {
+				out.writeByte(HeaderResponse.PROTOCOL_ACK.getValue());
+				clientEP.write(out);
+			} else if (protocolType == ProtocolType.SINGLE_OP) {
+				out.writeByte(HeaderResponse.PROTOCOL_ACK.getValue());
+			} else {
+				out.writeByte(HeaderResponse.PROTOCOL_NOT_SUPPORTED.getValue());
+			}
+		} catch (IOException e) {
+			throw new ProtocolException("Error sending Protocol answer");
+		}
+	}
+
+	/**
+	 * Reads the default client's Endpoint used to accept calls.
+	 * 
+	 * @return an {@link org.apache.harmony.rmi.internal.transport.EndpointID}
+	 */
+	public final EndpointID readEndpointNegotiation() {
+		EndpointID defaultEP = null;
+		try {
+			defaultEP = EndpointID.read(in);
+		} catch (IOException e) {
+			new ProtocolException("Exception reading EndpointID", e);
+		}
+		return defaultEP;
+	}
+
+	/**
+	 * Reads the initial handshake sequence sent by the client.
+	 * 
+	 * @param type
+	 *            a {@link ProtocolType} object indicating the protocol type
+	 * @throws ProtocolException
+	 *             if an exception occurs while reading the handshake data from
+	 *             the imput stream
+	 */
+	public final void readHandShake(ProtocolType type) throws ProtocolException {
+		Header header = new Header(type);
+		try {
+			header.readExternal(in);
+			protocolType = header.getProtocolType();
+		} catch (IOException e) {
+			throw new ProtocolException("I/O Error Reading Transport Header", e);
+		}
+	}
+
+	/**
+	 * Reads a {@link Message} object from the connection's input stream.
+	 * 
+	 * @return the {@link Message} object read.
+	 * @throws UnmarshalException
+	 *             if an exception occurs reading the input stream.
+	 */
+	public final Message readMessage() throws UnmarshalException {
+		Message msg = new Message();
+		try {
+			msg.readExternal(in);
+		} catch (IOException e) {
+			throw new UnmarshalException("IO error unmarshaling a message", e);
+		}
+		return msg;
+	}
+
+	/**
+	 * Writes a {@link MessageResponse#PING_ACK} into the ouput stream.
+	 * 
+	 * @throws ProtocolException
+	 *             if there is an error in the underlying protocol
+	 */
+	public final void writePingAck() throws ProtocolException {
+		try {
+			out.writeByte(MessageResponse.PING_ACK.getValue());
+		} catch (IOException e) {
+			throw new ProtocolException("I/O Error Marshaling a ProtocolAck", e);
+		}
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/MethodHashGenerator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/MethodHashGenerator.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/MethodHashGenerator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/MethodHashGenerator.java Thu May 18 23:00:52 2006
@@ -1,190 +1,190 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.utils;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/*
- * NOTE: 
- * This class has been modified in order to support 
- * Java VM 1.4.2 using the javac's target jsr14 
- */
-
-/**
- * This class provides the methods that compute the hash for a specific method
- * 
- * @author Horacio de Oro
- */
-public final class MethodHashGenerator {
-    private static MessageDigest md;
-    
-    static {
-        try {
-            md = MessageDigest.getInstance("SHA1");
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new InternalError("SHA1 not implemented: " + nsae);
-        }
-    }
-    
-    /**
-     * This method computes the hash of a specific method
-     * 
-     * @param method
-     *            to compute his hash
-     * @return the hash of the method
-     */
-    public final static long getMethodHash(final Method method) {
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        DataOutput dataOutput = new DataOutputStream(baos);
-
-        try {
-            dataOutput.writeUTF(getMethodDescriptor(method));
-        } catch (IOException ioe) {
-            throw new InternalError("IOException while using DataOutput: "
-                    + ioe);
-        }
-
-        byte[] bytes = baos.toByteArray();
-
-        byte[] digest = md.digest(bytes);
-
-        //
-        // 64-bit (long) integer computed from the
-        // first two 32-bit values of the message digest
-        //
-        // The 64-bit hash value is the little-endian composition of an eight
-        // byte sequence
-        // where the first four bytes are the first 32-bit value of the message
-        // digest in
-        // big-endian byte order and the last four bytes are the second 32-bit
-        // value of the
-        // message digest in big-endian byte order. For example, if the first
-        // two 32-bit
-        // values of the message digest are 0xB0B1B2B3 and 0xB4B5B6B7, then the
-        // hash value
-        // would be 0xB7B6B5B4B3B2B1B0.
-        //
-
-        byte[] hash = new byte[8];
-
-        hash[0] = digest[7];
-        hash[1] = digest[6];
-        hash[2] = digest[5];
-        hash[3] = digest[4];
-        hash[4] = digest[3];
-        hash[5] = digest[2];
-        hash[6] = digest[1];
-        hash[7] = digest[0];
-
-        return new BigInteger(hash).longValue();
-    }
-
-    /** Create the description of a method */
-    /**
-     * This method creates the description of a method
-     * 
-     * @param method
-     *            to create the descriptor
-     * @return a descriptor for the method
-     */
-    private final static String getMethodDescriptor(final Method method) {
-
-        StringBuffer sb = new StringBuffer();
-
-        sb.append(method.getName());
-        sb.append("(");
-
-        for (Class clazz : method.getParameterTypes())
-            sb.append(MethodHashGenerator.getFieldDescriptor(clazz));
-
-        sb.append(")");
-        sb.append(MethodHashGenerator
-                .getFieldDescriptor(method.getReturnType()));
-
-        return sb.toString();
-    }
-
-    /**
-     * This method returns the descriptor for the type represented by the class
-     * clazz
-     * 
-     * @param clazz
-     *            type to compute the descriptor
-     * @return the descriptor for the type represented by the class clazz
-     */
-    private final static String getFieldDescriptor(Class clazz) {
-
-        if (clazz == null) {
-            // TODO: what kind of
-            // exception should be
-            // thrown here?
-            throw new InternalError("clazz == null!"); 
-        }
-        
-        if (clazz.isArray()) {
-            return clazz.getName().replace('.', '/');
-        }
-
-        if (clazz.isPrimitive()) {
-
-            if (clazz.equals(Boolean.TYPE))
-                return "Z";
-
-            else if (clazz.equals(Character.TYPE))
-                return "C";
-
-            else if (clazz.equals(Byte.TYPE))
-                return "B";
-
-            else if (clazz.equals(Short.TYPE))
-                return "S";
-
-            else if (clazz.equals(Integer.TYPE))
-                return "I";
-
-            else if (clazz.equals(Long.TYPE))
-                return "J";
-
-            else if (clazz.equals(Float.TYPE))
-                return "F";
-
-            else if (clazz.equals(Double.TYPE))
-                return "D";
-
-            else if (clazz.equals(Void.TYPE))
-                return "V";
-
-            else
-                throw new InternalError("Unknown primitive type: " + clazz);
-
-        }
-
-        //
-        // clazz.isPrimitive() == false
-        //
-
-        return "L" + clazz.getName().replace('.', '/') + ";";
-
-    }
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/*
+ * NOTE: 
+ * This class has been modified in order to support 
+ * Java VM 1.4.2 using the javac's target jsr14 
+ */
+
+/**
+ * This class provides the methods that compute the hash for a specific method
+ * 
+ * @author Horacio de Oro
+ */
+public final class MethodHashGenerator {
+    private static MessageDigest md;
+    
+    static {
+        try {
+            md = MessageDigest.getInstance("SHA1");
+        } catch (NoSuchAlgorithmException nsae) {
+            throw new InternalError("SHA1 not implemented: " + nsae);
+        }
+    }
+    
+    /**
+     * This method computes the hash of a specific method
+     * 
+     * @param method
+     *            to compute his hash
+     * @return the hash of the method
+     */
+    public final static long getMethodHash(final Method method) {
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        DataOutput dataOutput = new DataOutputStream(baos);
+
+        try {
+            dataOutput.writeUTF(getMethodDescriptor(method));
+        } catch (IOException ioe) {
+            throw new InternalError("IOException while using DataOutput: "
+                    + ioe);
+        }
+
+        byte[] bytes = baos.toByteArray();
+
+        byte[] digest = md.digest(bytes);
+
+        //
+        // 64-bit (long) integer computed from the
+        // first two 32-bit values of the message digest
+        //
+        // The 64-bit hash value is the little-endian composition of an eight
+        // byte sequence
+        // where the first four bytes are the first 32-bit value of the message
+        // digest in
+        // big-endian byte order and the last four bytes are the second 32-bit
+        // value of the
+        // message digest in big-endian byte order. For example, if the first
+        // two 32-bit
+        // values of the message digest are 0xB0B1B2B3 and 0xB4B5B6B7, then the
+        // hash value
+        // would be 0xB7B6B5B4B3B2B1B0.
+        //
+
+        byte[] hash = new byte[8];
+
+        hash[0] = digest[7];
+        hash[1] = digest[6];
+        hash[2] = digest[5];
+        hash[3] = digest[4];
+        hash[4] = digest[3];
+        hash[5] = digest[2];
+        hash[6] = digest[1];
+        hash[7] = digest[0];
+
+        return new BigInteger(hash).longValue();
+    }
+
+    /** Create the description of a method */
+    /**
+     * This method creates the description of a method
+     * 
+     * @param method
+     *            to create the descriptor
+     * @return a descriptor for the method
+     */
+    private final static String getMethodDescriptor(final Method method) {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append(method.getName());
+        sb.append("(");
+
+        for (Class clazz : method.getParameterTypes())
+            sb.append(MethodHashGenerator.getFieldDescriptor(clazz));
+
+        sb.append(")");
+        sb.append(MethodHashGenerator
+                .getFieldDescriptor(method.getReturnType()));
+
+        return sb.toString();
+    }
+
+    /**
+     * This method returns the descriptor for the type represented by the class
+     * clazz
+     * 
+     * @param clazz
+     *            type to compute the descriptor
+     * @return the descriptor for the type represented by the class clazz
+     */
+    private final static String getFieldDescriptor(Class clazz) {
+
+        if (clazz == null) {
+            // TODO: what kind of
+            // exception should be
+            // thrown here?
+            throw new InternalError("clazz == null!"); 
+        }
+        
+        if (clazz.isArray()) {
+            return clazz.getName().replace('.', '/');
+        }
+
+        if (clazz.isPrimitive()) {
+
+            if (clazz.equals(Boolean.TYPE))
+                return "Z";
+
+            else if (clazz.equals(Character.TYPE))
+                return "C";
+
+            else if (clazz.equals(Byte.TYPE))
+                return "B";
+
+            else if (clazz.equals(Short.TYPE))
+                return "S";
+
+            else if (clazz.equals(Integer.TYPE))
+                return "I";
+
+            else if (clazz.equals(Long.TYPE))
+                return "J";
+
+            else if (clazz.equals(Float.TYPE))
+                return "F";
+
+            else if (clazz.equals(Double.TYPE))
+                return "D";
+
+            else if (clazz.equals(Void.TYPE))
+                return "V";
+
+            else
+                throw new InternalError("Unknown primitive type: " + clazz);
+
+        }
+
+        //
+        // clazz.isPrimitive() == false
+        //
+
+        return "L" + clazz.getName().replace('.', '/') + ";";
+
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/Pair.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/Pair.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/Pair.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/Pair.java Thu May 18 23:00:52 2006
@@ -1,85 +1,85 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.utils;
-
-/**
- * This class implements a generic pair.
- * 
- * @author Gustavo Petri
- */
-public final class Pair<E, T> {
-    private E comp1;
-
-    private T comp2;
-
-    /**
-     * @param comp1
-     *            first component
-     * @param comp2
-     *            second component
-     */
-    public Pair(E comp1, T comp2) {
-        this.comp1 = comp1;
-        this.comp2 = comp2;
-    }
-
-    /**
-     * @return the first component of pair
-     */
-    public final E getFirst() {
-        return comp1;
-    }
-
-    /**
-     * @return the second component of pair
-     */
-    public final T getSecond() {
-        return comp2;
-    }
-
-    /**
-     * @param o
-     *            the object that will be compared for equality.
-     * @return <code>true</code> if <code>obj</code> is instance of the
-     *         class <code>Pair</code>, else return <code>false</code>
-     */
-    public final boolean equals(Object o) {
-
-        if (o == null)
-            return false;
-        if (o == this)
-            return true;
-        if (!(o instanceof Pair))
-            return false;
-        Pair oPair = (Pair) o;
-        return (this.comp1.equals(oPair.comp1) && this.comp2
-                .equals(oPair.comp2));
-    }
-
-    /**
-     * @return the hash code for this object.
-     */
-    public final int hashCode() {
-        return this.comp1.hashCode() ^ this.comp2.hashCode();
-    }
-
-    /**
-     * @return a description of the contained of an object of this class
-     */
-    public final String toString() {
-        return "Pair " + this.comp1.toString() + ", " + this.comp2.toString();
-    }
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.utils;
+
+/**
+ * This class implements a generic pair.
+ * 
+ * @author Gustavo Petri
+ */
+public final class Pair<E, T> {
+    private E comp1;
+
+    private T comp2;
+
+    /**
+     * @param comp1
+     *            first component
+     * @param comp2
+     *            second component
+     */
+    public Pair(E comp1, T comp2) {
+        this.comp1 = comp1;
+        this.comp2 = comp2;
+    }
+
+    /**
+     * @return the first component of pair
+     */
+    public final E getFirst() {
+        return comp1;
+    }
+
+    /**
+     * @return the second component of pair
+     */
+    public final T getSecond() {
+        return comp2;
+    }
+
+    /**
+     * @param o
+     *            the object that will be compared for equality.
+     * @return <code>true</code> if <code>obj</code> is instance of the
+     *         class <code>Pair</code>, else return <code>false</code>
+     */
+    public final boolean equals(Object o) {
+
+        if (o == null)
+            return false;
+        if (o == this)
+            return true;
+        if (!(o instanceof Pair))
+            return false;
+        Pair oPair = (Pair) o;
+        return (this.comp1.equals(oPair.comp1) && this.comp2
+                .equals(oPair.comp2));
+    }
+
+    /**
+     * @return the hash code for this object.
+     */
+    public final int hashCode() {
+        return this.comp1.hashCode() ^ this.comp2.hashCode();
+    }
+
+    /**
+     * @return a description of the contained of an object of this class
+     */
+    public final String toString() {
+        return "Pair " + this.comp1.toString() + ", " + this.comp2.toString();
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PrintStreamHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PrintStreamHandler.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PrintStreamHandler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PrintStreamHandler.java Thu May 18 23:00:52 2006
@@ -1,87 +1,87 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.utils;
-
-import java.io.PrintStream;
-import java.util.logging.LogRecord;
-import java.util.logging.StreamHandler;
-
-/**
- * This handler publishes log records into a <code>PrintStream</code>.
- * 
- * @author Gonzalo Ortega
- */
-public final class PrintStreamHandler extends StreamHandler {
-
-    private PrintStream out;
-
-    /**
-     * Creates a new <code>PrintStreamHandler</code>, with
-     * <code>System.err</code> as destiny for the log records.
-     */
-    public PrintStreamHandler() {
-        out = System.err;
-        super.setOutputStream(out);
-    }
-
-    /**
-     * Creates a new <code>PrintStreamHandler<code>, with <code>out</code> 
-     * as destiny for the log records. 
-     *
-     * @param out The <code>PrintStream</code> where the messages will be logged to
-     */
-    public PrintStreamHandler(PrintStream out) {
-        if (out != null) {
-            super.setOutputStream(out);
-        }
-        this.out = out;
-    }
-
-    /**
-     * @param record
-     *            The log record to be published
-     */
-    @Override
-    public final void publish(LogRecord record) {
-        if ((out != null) && isLoggable(record)) {
-            out.println(getFormatter().format(record));
-            out.flush();
-        }
-    }
-
-    /**
-     * @param out
-     *            The <code>PrintStream</code> where the messages will be
-     *            logged, or <code>null</code> if no logging is desired.
-     */
-    public void setOutputPrintStream(PrintStream out) {
-        this.out = out;
-    }
-
-    /**
-     * 
-     */
-    @Override
-    public final void close() {
-        if (out != null) {
-            super.close();
-            if (out != System.err) {
-                out.close();
-            }
-        }
-    }
-
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.utils;
+
+import java.io.PrintStream;
+import java.util.logging.LogRecord;
+import java.util.logging.StreamHandler;
+
+/**
+ * This handler publishes log records into a <code>PrintStream</code>.
+ * 
+ * @author Gonzalo Ortega
+ */
+public final class PrintStreamHandler extends StreamHandler {
+
+    private PrintStream out;
+
+    /**
+     * Creates a new <code>PrintStreamHandler</code>, with
+     * <code>System.err</code> as destiny for the log records.
+     */
+    public PrintStreamHandler() {
+        out = System.err;
+        super.setOutputStream(out);
+    }
+
+    /**
+     * Creates a new <code>PrintStreamHandler<code>, with <code>out</code> 
+     * as destiny for the log records. 
+     *
+     * @param out The <code>PrintStream</code> where the messages will be logged to
+     */
+    public PrintStreamHandler(PrintStream out) {
+        if (out != null) {
+            super.setOutputStream(out);
+        }
+        this.out = out;
+    }
+
+    /**
+     * @param record
+     *            The log record to be published
+     */
+    @Override
+    public final void publish(LogRecord record) {
+        if ((out != null) && isLoggable(record)) {
+            out.println(getFormatter().format(record));
+            out.flush();
+        }
+    }
+
+    /**
+     * @param out
+     *            The <code>PrintStream</code> where the messages will be
+     *            logged, or <code>null</code> if no logging is desired.
+     */
+    public void setOutputPrintStream(PrintStream out) {
+        this.out = out;
+    }
+
+    /**
+     * 
+     */
+    @Override
+    public final void close() {
+        if (out != null) {
+            super.close();
+            if (out != System.err) {
+                out.close();
+            }
+        }
+    }
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PropertiesReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PropertiesReader.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PropertiesReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/PropertiesReader.java Thu May 18 23:00:52 2006
@@ -1,77 +1,77 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.utils;
-
-/*
- * NOTE: 
- * This class has been modified in order to support 
- * Java VM 1.4.2 using the javac's target jsr14 
- */
-
-public final class PropertiesReader {
-
-    /** To prevent instantiation */
-    private PropertiesReader() {}
-    
-    public final static int readInt(String name, int defaultValue) {
-        int ret;
-        try {
-            ret = Integer.parseInt(System.getProperty(name));
-            if (ret < 0) {
-                // TODO LOG HERE
-                ret = defaultValue;
-            }
-        } catch (NumberFormatException e) {
-            // TODO LOG HERE
-            ret = defaultValue;
-        }
-        return ret;
-    }
-
-    public final static long readLong(String name, long defaultValue) {
-        long ret;
-        try {
-            ret = new Long(System.getProperty(name));
-            if (ret < 0) {
-                // TODO LOG HERE
-                ret = defaultValue;
-            }
-        } catch (NumberFormatException e) {
-            // TODO LOG HERE
-            ret = defaultValue;
-        }
-        return ret;    
-    }
-    
-    public final static boolean readBoolean(String name, boolean defaultValue) {
-        boolean ret;
-        try {
-            ret = Boolean.valueOf(System.getProperty(name));
-        } catch (Exception e) {   // TODO: exception name
-            // TODO LOG HERE
-            ret = defaultValue;
-        }
-        return ret;
-    }
-    
-    public final static String readString (String name) {
-        String ret = System.getProperty(name);
-        if (ret == null) {
-            // TODO LOG HERE
-        }
-        return ret; 
-    }
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.utils;
+
+/*
+ * NOTE: 
+ * This class has been modified in order to support 
+ * Java VM 1.4.2 using the javac's target jsr14 
+ */
+
+public final class PropertiesReader {
+
+    /** To prevent instantiation */
+    private PropertiesReader() {}
+    
+    public final static int readInt(String name, int defaultValue) {
+        int ret;
+        try {
+            ret = Integer.parseInt(System.getProperty(name));
+            if (ret < 0) {
+                // TODO LOG HERE
+                ret = defaultValue;
+            }
+        } catch (NumberFormatException e) {
+            // TODO LOG HERE
+            ret = defaultValue;
+        }
+        return ret;
+    }
+
+    public final static long readLong(String name, long defaultValue) {
+        long ret;
+        try {
+            ret = new Long(System.getProperty(name));
+            if (ret < 0) {
+                // TODO LOG HERE
+                ret = defaultValue;
+            }
+        } catch (NumberFormatException e) {
+            // TODO LOG HERE
+            ret = defaultValue;
+        }
+        return ret;    
+    }
+    
+    public final static boolean readBoolean(String name, boolean defaultValue) {
+        boolean ret;
+        try {
+            ret = Boolean.valueOf(System.getProperty(name));
+        } catch (Exception e) {   // TODO: exception name
+            // TODO LOG HERE
+            ret = defaultValue;
+        }
+        return ret;
+    }
+    
+    public final static String readString (String name) {
+        String ret = System.getProperty(name);
+        if (ret == null) {
+            // TODO LOG HERE
+        }
+        return ret; 
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/RemoteUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/RemoteUtils.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/RemoteUtils.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/RemoteUtils.java Thu May 18 23:00:52 2006
@@ -1,122 +1,122 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.utils;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-
-/**
- * A Collection of utility methods used to get the Remote interfaces and
- * methods from a Class.
- * 
- * @author Gonzalo Ortega
- */
-public final class RemoteUtils {
-	
-	/**
-	 * Map used to cache the remote interfaces of a class, saving time when
-	 * exporting multiple instances of the same class. 
-	 */
-	static Map<Class, Set<Class>> remoteInterfacesCache;
-
-	static {
-		remoteInterfacesCache = Collections.synchronizedMap(new WeakHashMap<Class, Set<Class>>());
-	}
-	
-    /**
-     * Returns a set containing all the remote interfaces implemented by a class
-     * 
-     * @param inspect
-     *            the class that implements the remote interfaces
-     * @return A <code>Set</code> containing all the remote interfaces
-     *         implemented by a class
-     */
-    public final static Set<Class> getRemoteInterfaces(Class inspect) {
-    	if (remoteInterfacesCache.containsKey(inspect)) {
-    		return remoteInterfacesCache.get(inspect);
-    	}
-        LinkedHashSet<Class> classSet = new LinkedHashSet<Class>();
-        Class clazz = inspect;
-        do {
-            getRemoteInterfacesAux(clazz, classSet);
-        } while ((clazz = clazz.getSuperclass()) != null);
-        remoteInterfacesCache.put(inspect, classSet);
-        return classSet;
-    }
-
-    /**
-     * Auxiliary method needed for <code>getRemoteInterfaces</code>
-     * 
-     * @param inspect
-     *            The class or intarface that implements or extends the remote
-     *            interface
-     * @param classSet
-     *            A <code>Set</code> where the found remote intrefaces are
-     *            stored
-     * @return <code>true</code> if the received intarface is
-     *         <code>Remote</code>
-     */
-    private final static boolean getRemoteInterfacesAux(Class inspect,
-            Set<Class> classSet) {
-        boolean isRemote = false;
-
-        Class[] allInterfaces = inspect.getInterfaces();
-        for (int x = 0; x < allInterfaces.length; x++) {
-            isRemote = isRemote
-                    | getRemoteInterfacesAux(allInterfaces[x], classSet);
-        }
-        if (inspect.equals(java.rmi.Remote.class)) {
-            isRemote = true;
-        }
-        if (isRemote && inspect.isInterface()) {
-            classSet.add(inspect);
-        }
-        return isRemote;
-    }
-
-    /**
-     * Returns a set containing all the remote methods declared by all the
-     * remote interfaces implemented by a class.
-     * 
-     * @param inspect
-     *            the class that implements the remote interfaces
-     * @return A <code>Set</code> containing all the remote methods of the
-     *         class
-     */
-    public final static Set<Method> getRemoteMethods(Class inspect) {
-        Set<Class> classSet = getRemoteInterfaces(inspect);
-        LinkedHashSet<Method> methods = new LinkedHashSet<Method>();
-
-        for (Class interfaz : classSet) {
-            Method[] methodArray = interfaz.getDeclaredMethods();
-            for (int y = 0; y < methodArray.length; y++) {
-                Class[] exceptions = methodArray[y].getExceptionTypes();
-                for (Class clazz : exceptions) {
-                    if (clazz.equals(java.rmi.RemoteException.class)
-                            || clazz.equals(java.io.IOException.class)
-                            || clazz.equals(java.lang.Exception.class)) {
-                        methods.add(methodArray[y]);
-                    }
-                }
-            }
-        }
-        return methods;
-    }
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.utils;
+
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
+
+/**
+ * A Collection of utility methods used to get the Remote interfaces and
+ * methods from a Class.
+ * 
+ * @author Gonzalo Ortega
+ */
+public final class RemoteUtils {
+	
+	/**
+	 * Map used to cache the remote interfaces of a class, saving time when
+	 * exporting multiple instances of the same class. 
+	 */
+	static Map<Class, Set<Class>> remoteInterfacesCache;
+
+	static {
+		remoteInterfacesCache = Collections.synchronizedMap(new WeakHashMap<Class, Set<Class>>());
+	}
+	
+    /**
+     * Returns a set containing all the remote interfaces implemented by a class
+     * 
+     * @param inspect
+     *            the class that implements the remote interfaces
+     * @return A <code>Set</code> containing all the remote interfaces
+     *         implemented by a class
+     */
+    public final static Set<Class> getRemoteInterfaces(Class inspect) {
+    	if (remoteInterfacesCache.containsKey(inspect)) {
+    		return remoteInterfacesCache.get(inspect);
+    	}
+        LinkedHashSet<Class> classSet = new LinkedHashSet<Class>();
+        Class clazz = inspect;
+        do {
+            getRemoteInterfacesAux(clazz, classSet);
+        } while ((clazz = clazz.getSuperclass()) != null);
+        remoteInterfacesCache.put(inspect, classSet);
+        return classSet;
+    }
+
+    /**
+     * Auxiliary method needed for <code>getRemoteInterfaces</code>
+     * 
+     * @param inspect
+     *            The class or intarface that implements or extends the remote
+     *            interface
+     * @param classSet
+     *            A <code>Set</code> where the found remote intrefaces are
+     *            stored
+     * @return <code>true</code> if the received intarface is
+     *         <code>Remote</code>
+     */
+    private final static boolean getRemoteInterfacesAux(Class inspect,
+            Set<Class> classSet) {
+        boolean isRemote = false;
+
+        Class[] allInterfaces = inspect.getInterfaces();
+        for (int x = 0; x < allInterfaces.length; x++) {
+            isRemote = isRemote
+                    | getRemoteInterfacesAux(allInterfaces[x], classSet);
+        }
+        if (inspect.equals(java.rmi.Remote.class)) {
+            isRemote = true;
+        }
+        if (isRemote && inspect.isInterface()) {
+            classSet.add(inspect);
+        }
+        return isRemote;
+    }
+
+    /**
+     * Returns a set containing all the remote methods declared by all the
+     * remote interfaces implemented by a class.
+     * 
+     * @param inspect
+     *            the class that implements the remote interfaces
+     * @return A <code>Set</code> containing all the remote methods of the
+     *         class
+     */
+    public final static Set<Method> getRemoteMethods(Class inspect) {
+        Set<Class> classSet = getRemoteInterfaces(inspect);
+        LinkedHashSet<Method> methods = new LinkedHashSet<Method>();
+
+        for (Class interfaz : classSet) {
+            Method[] methodArray = interfaz.getDeclaredMethods();
+            for (int y = 0; y < methodArray.length; y++) {
+                Class[] exceptions = methodArray[y].getExceptionTypes();
+                for (Class clazz : exceptions) {
+                    if (clazz.equals(java.rmi.RemoteException.class)
+                            || clazz.equals(java.io.IOException.class)
+                            || clazz.equals(java.lang.Exception.class)) {
+                        methods.add(methodArray[y]);
+                    }
+                }
+            }
+        }
+        return methods;
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/ReversibleHashSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/ReversibleHashSet.java?rev=407724&r1=407183&r2=407724&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/ReversibleHashSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/org/apache/harmony/rmi/internal/utils/ReversibleHashSet.java Thu May 18 23:00:52 2006
@@ -1,121 +1,121 @@
-/* 
-*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
-* 
-*  Licensed under the Apache License, Version 2.0 (the "License"); 
-*  you may not use this file except in compliance with the License. 
-*  You may obtain a copy of the License at 
-* 
-*    http://www.apache.org/licenses/LICENSE-2.0 
-* 
-*  Unless required by applicable law or agreed to in writing, software 
-*  distributed under the License is distributed on an "AS IS" BASIS, 
-*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-*  See the License for the specific language governing permissions and 
-*  limitations under the License. 
-*/
-package ar.org.fitc.rmi.utils;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * 
- * This class constructs a generic structure by which is possible to relate one
- * element "A1" with a list of elements "L11, L12, ..., L1n". This structure
- * also maintains a list of these relationships "A1, A2, …, Am" with the
- * corresponding series "L11, L12, ..., L1n, ...", "L21, L22, ..., L2n", ...,
- * "Lm1, Lm2, ..., Lmn". Thus, if an element "Ai" is known, this class provides
- * a method that returns a corresponding list of elements "Li". On the other
- * hand, if an element "Lij" of the list is known, this class provides a method
- * that return the element "Ai" which contains "Lij".
- * 
- * @author Gustavo Petri
- */
-
-public final class ReversibleHashSet<E, T> {
-
-    private HashMap<E, Set<T>> oneToMany;
-
-    private HashMap<T, E> oneToOne;
-
-    /**
-     * Constructor of the class
-     */
-    public ReversibleHashSet() {
-        this.oneToMany = new HashMap<E, Set<T>>();
-        this.oneToOne = new HashMap<T, E>();
-    }
-
-    /**
-     * This method inserts a value
-     * 
-     * @param key
-     *            the value of the series's identifier
-     * @param value
-     *            of the an element of the series
-     */
-    public final void insert(E key, T value) {
-
-        if (oneToMany.get(key) != null) {
-            oneToMany.get(key).add(value);
-        } else {
-            HashSet<T> newHashSet = new HashSet<T>();
-            newHashSet.add(value);
-            oneToMany.put(key, newHashSet);
-        }
-        oneToOne.put(value, key);
-
-        return;
-    }
-
-    /**
-     * This method returns a list of the elements of the series
-     * 
-     * @param key
-     *            the value of the series's identifier
-     * @return a list of the elements of the series
-     */
-    public final Set<T> getValues(E key) {
-        return oneToMany.get(key);
-    }
-
-    /**
-     * This method returns the value of the series's identifier
-     * 
-     * @param value
-     *            of the an element of the series
-     * @return the key of the series, the value of the series's identifier
-     */
-    public final E getKeyFromValue(T value) {
-        return oneToOne.get(value);
-    }
-
-    /**
-     * This method validate if exists an element in the series
-     * 
-     * @param key
-     *            the value of the series's identifier
-     * @return <code>true</code> if exists an element in the list, else
-     *         <code>false</code>
-     */
-    public final  boolean hasValues(E key) {
-        return !(oneToMany.get(key) == null);
-    }
-
-    /**
-     * This method remove a value of the series
-     * 
-     * @param value
-     *            of the an element of the series
-     */
-    public final void removeValue(T value) {
-        E key = oneToOne.get(value);
-        if (key != null) {
-            oneToMany.get(key).remove(value);
-            oneToOne.remove(value);
-            if (oneToMany.get(key).isEmpty())
-                oneToMany.remove(key);
-        }
-    }
-}
+/* 
+*  Copyright 2005 The Apache Software Foundation or its licensors, as applicable. 
+* 
+*  Licensed under the Apache License, Version 2.0 (the "License"); 
+*  you may not use this file except in compliance with the License. 
+*  You may obtain a copy of the License at 
+* 
+*    http://www.apache.org/licenses/LICENSE-2.0 
+* 
+*  Unless required by applicable law or agreed to in writing, software 
+*  distributed under the License is distributed on an "AS IS" BASIS, 
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+*  See the License for the specific language governing permissions and 
+*  limitations under the License. 
+*/
+package org.apache.harmony.rmi.internal.utils;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 
+ * This class constructs a generic structure by which is possible to relate one
+ * element "A1" with a list of elements "L11, L12, ..., L1n". This structure
+ * also maintains a list of these relationships "A1, A2, …, Am" with the
+ * corresponding series "L11, L12, ..., L1n, ...", "L21, L22, ..., L2n", ...,
+ * "Lm1, Lm2, ..., Lmn". Thus, if an element "Ai" is known, this class provides
+ * a method that returns a corresponding list of elements "Li". On the other
+ * hand, if an element "Lij" of the list is known, this class provides a method
+ * that return the element "Ai" which contains "Lij".
+ * 
+ * @author Gustavo Petri
+ */
+
+public final class ReversibleHashSet<E, T> {
+
+    private HashMap<E, Set<T>> oneToMany;
+
+    private HashMap<T, E> oneToOne;
+
+    /**
+     * Constructor of the class
+     */
+    public ReversibleHashSet() {
+        this.oneToMany = new HashMap<E, Set<T>>();
+        this.oneToOne = new HashMap<T, E>();
+    }
+
+    /**
+     * This method inserts a value
+     * 
+     * @param key
+     *            the value of the series's identifier
+     * @param value
+     *            of the an element of the series
+     */
+    public final void insert(E key, T value) {
+
+        if (oneToMany.get(key) != null) {
+            oneToMany.get(key).add(value);
+        } else {
+            HashSet<T> newHashSet = new HashSet<T>();
+            newHashSet.add(value);
+            oneToMany.put(key, newHashSet);
+        }
+        oneToOne.put(value, key);
+
+        return;
+    }
+
+    /**
+     * This method returns a list of the elements of the series
+     * 
+     * @param key
+     *            the value of the series's identifier
+     * @return a list of the elements of the series
+     */
+    public final Set<T> getValues(E key) {
+        return oneToMany.get(key);
+    }
+
+    /**
+     * This method returns the value of the series's identifier
+     * 
+     * @param value
+     *            of the an element of the series
+     * @return the key of the series, the value of the series's identifier
+     */
+    public final E getKeyFromValue(T value) {
+        return oneToOne.get(value);
+    }
+
+    /**
+     * This method validate if exists an element in the series
+     * 
+     * @param key
+     *            the value of the series's identifier
+     * @return <code>true</code> if exists an element in the list, else
+     *         <code>false</code>
+     */
+    public final  boolean hasValues(E key) {
+        return !(oneToMany.get(key) == null);
+    }
+
+    /**
+     * This method remove a value of the series
+     * 
+     * @param value
+     *            of the an element of the series
+     */
+    public final void removeValue(T value) {
+        E key = oneToOne.get(value);
+        if (key != null) {
+            oneToMany.get(key).remove(value);
+            oneToOne.remove(value);
+            if (oneToMany.get(key).isEmpty())
+                oneToMany.remove(key);
+        }
+    }
+}



Mime
View raw message