[154700] JS EAR Library container performance
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/HashUtil.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/HashUtil.java
new file mode 100644
index 0000000..6e48a2e
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/HashUtil.java
@@ -0,0 +1,19 @@
+package org.eclipse.wst.common.frameworks.internal;
+
+public class HashUtil {
+
+	public static int SEED = 11;
+	private static int MULTI = 31;
+	
+	public static int hash(int seed, int i){
+		return seed * MULTI + i;
+	}
+	
+	public static int hash(int seed, Object obj){
+		return hash(seed, null != obj ? obj.hashCode() : SEED);
+	}
+	
+	public static int hash(int seed, boolean b){
+		return hash(seed, b ? 1 : SEED);
+	}
+}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
index 4d52392..5ca7f0f 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualArchiveComponent.java
@@ -28,6 +28,7 @@
 import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
 import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
 import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.common.frameworks.internal.HashUtil;
 
 
 public class VirtualArchiveComponent implements IVirtualComponent, IAdaptable {
@@ -56,6 +57,9 @@
 
 
 	public VirtualArchiveComponent(IProject aComponentProject,String archiveLocation, IPath aRuntimePath) {
+		if(aComponentProject == null){
+			throw new NullPointerException();
+		}
 		componentProject = aComponentProject;
 		runtimePath = aRuntimePath;
 
@@ -190,6 +194,14 @@
 		return archiveType;
 	}
 
+	public int hashCode() {
+		int hash = HashUtil.SEED;
+		hash = HashUtil.hash(hash, getProject().getName());
+		hash = HashUtil.hash(hash, getName());
+		hash = HashUtil.hash(hash, isBinary());
+		return hash;
+	}
+	
 	public boolean equals(Object anOther) {
 		if (anOther instanceof VirtualArchiveComponent) {
 			VirtualArchiveComponent otherComponent = (VirtualArchiveComponent) anOther;
@@ -243,4 +255,11 @@
 		return diskFile;
 	}
 
+	public String toString() {
+		if(archivePath != null){
+			return componentProject + " " +archivePath;
+		}
+		return super.toString();
+	}
+	
 }
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
index 00a3111..4ef1934 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
@@ -37,6 +37,7 @@
 import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
 import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
 import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.common.frameworks.internal.HashUtil;
 
 
 public class VirtualComponent implements IVirtualComponent {
@@ -51,6 +52,9 @@
 	}
 	
 	public VirtualComponent(IProject aProject, IPath aRuntimePath) {
+		if(aProject == null){
+			throw new NullPointerException();
+		}
 		componentProject = aProject;
 		runtimePath = aRuntimePath;
 		rootFolder = ComponentCore.createFolder(componentProject, new Path("/")); //$NON-NLS-1$
@@ -361,14 +365,20 @@
 		}	
 	}
 
+	public int hashCode() {
+		int hash = HashUtil.SEED;
+		hash = HashUtil.hash(hash, getProject().getName());
+		hash = HashUtil.hash(hash, getName());
+		hash = HashUtil.hash(hash, isBinary());
+		return hash;
+	}
 	
 	public boolean equals(Object anOther) { 
 		if(anOther instanceof IVirtualComponent) {
 			IVirtualComponent otherComponent = (IVirtualComponent) anOther;
-			return getProject() !=null && 
-					getProject().equals(otherComponent.getProject()) && 
-					getName().equals(otherComponent.getName()) && 
-					isBinary() == otherComponent.isBinary();
+			return getProject().equals(otherComponent.getProject()) && 
+				   getName().equals(otherComponent.getName()) && 
+				   isBinary() == otherComponent.isBinary();
 		}
 		return false;
 	}
@@ -493,4 +503,8 @@
 				core.dispose();
 		}		
 	}
+	
+	public String toString() {
+		return componentProject.toString();
+	}
 }