Print

Print


Commit in GeomConverter/src/org/lcsim/detector on MAIN
DetectorElementStore.java+17-21.9 -> 1.10
JM: Just a few comments added and a basic toString() method.

GeomConverter/src/org/lcsim/detector
DetectorElementStore.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- DetectorElementStore.java	24 Jul 2007 22:57:50 -0000	1.9
+++ DetectorElementStore.java	28 Aug 2007 03:23:00 -0000	1.10
@@ -24,16 +24,21 @@
     	// Add to list.
     	super.add(de);
     	
-    	// Check to see if the id is cacheable...
+    	//System.out.println("adding DetectorElement " + de.getName() +" ...");
+    	
+    	// Check to see if the id is cacheable ...
     	
     	IIdentifier id = de.getIdentifier(); 
 
+    	// Is the id non-null?
     	if (id != null)
     	{
+    		// Is the id flagged as valid?
     		if (id.isValid())
     		{
     			IDetectorElementContainer dups = find(id);
     		
+    			// Is the id unique?
     			if (dups.size() > 0)
     			{
     				throw new IllegalArgumentException("Cannot add DetectorElement <" 
@@ -41,7 +46,7 @@
     						+"> is already used by <"+dups.get(0).getName()+">.");
     			}    		
 
-    			// Cache this DE by id in the lookup map.
+    			// Cache this DE in the lookup map.
     			cache.put(id.getValue(), de);
     		}
     	}
@@ -56,4 +61,14 @@
     	if (lookup != null) match.add(lookup);
     	return match;
     }                
+ 
+    public String toString()
+    {
+    	StringBuffer buff = new StringBuffer();
+    	for (IDetectorElement de : this)
+    	{
+    		buff.append(de.getName());
+    	}
+    	return buff.toString();
+    }
 }
\ No newline at end of file
CVSspam 0.2.8