Commit in GeomConverter/src/org/lcsim/detector/identifier on MAIN
IIdentifierDictionary.java+17-21.8 -> 1.9
IdentifierDictionary.java+14-11.5 -> 1.6
+31-3
2 modified files
JM: Add IdentifierContext support to IdentifierDictionary.

GeomConverter/src/org/lcsim/detector/identifier
IIdentifierDictionary.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- IIdentifierDictionary.java	6 Sep 2007 10:00:49 -0000	1.8
+++ IIdentifierDictionary.java	13 Oct 2007 00:56:34 -0000	1.9
@@ -7,7 +7,7 @@
  * that define the fields of an {@link IIdentifier}.
  *
  * @author Jeremy McCormick
- * @version $Id: IIdentifierDictionary.java,v 1.8 2007/09/06 10:00:49 jeremy Exp $
+ * @version $Id: IIdentifierDictionary.java,v 1.9 2007/10/13 00:56:34 jeremy Exp $
  */
 public interface IIdentifierDictionary
 {
@@ -88,7 +88,22 @@
      * @return True if has index.
      */
     public boolean hasIndex(int i);
- 
+    
+    /**
+     * Add an {@link IIdentifierContext} associated with <code>name</code>, which should
+     * be a unique name within this dictionary.
+     * @param name The name of the IdentifierContext
+     * @param context The IdentifierContext.
+     */
+    public void addIdentifierContext(String name, IIdentifierContext context);
+        
+    /**
+     * Get an {@link IIdenfitierContext} by name.
+     * @param name The name of the context.
+     * @return The IdentifierContext associated with <code>name</code>.
+     */    
+    public IIdentifierContext getIdentifierContext(String name);
+    
     /**
      * Thrown when a field lookup fails.     
      */

GeomConverter/src/org/lcsim/detector/identifier
IdentifierDictionary.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- IdentifierDictionary.java	28 Aug 2007 22:25:46 -0000	1.5
+++ IdentifierDictionary.java	13 Oct 2007 00:56:34 -0000	1.6
@@ -8,7 +8,7 @@
  * Implementation of {@link IIdentifierDictionary}.
  *
  * @author Jeremy McCormick
- * @version $Id: IdentifierDictionary.java,v 1.5 2007/08/28 22:25:46 jeremy Exp $
+ * @version $Id: IdentifierDictionary.java,v 1.6 2007/10/13 00:56:34 jeremy Exp $
  */
 
 public class IdentifierDictionary implements IIdentifierDictionary
@@ -16,6 +16,7 @@
     Map<String,IIdentifierField> fields = new LinkedHashMap<String,IIdentifierField>();
     Map<Integer,IIdentifierField> fieldOrder = new HashMap<Integer, IIdentifierField>();
     Map<String,Integer> nameOrder = new HashMap<String,Integer>();
+    Map<String,IIdentifierContext> contexts = new HashMap<String,IIdentifierContext>();
     private String name;
            
     public IdentifierDictionary(String name)
@@ -113,4 +114,16 @@
     {
         return fieldOrder.containsKey(i);
     }    
+    
+    public void addIdentifierContext(String name, IIdentifierContext context)
+    {
+    	if (contexts.containsKey(name))
+    		throw new RuntimeException("IdContext " + name + " is already defined!");
+    	contexts.put(name,context);
+    }
+    
+    public IIdentifierContext getIdentifierContext(String name)
+    {
+    	return contexts.get(name);    	
+    }
 }
\ No newline at end of file
CVSspam 0.2.8