Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

DynamicMap.java

00001 package gov.nasa.arc.ase.jpf.jvm;
00002 
00003 //#ifdef !NO_DYNAMIC_SYMMETRY
00004 import java.util.Hashtable;
00005 
00006 class DynamicMap {
00007   static Hashtable mapping = new Hashtable();
00008   static int counter = 0;
00009 
00010   public static int addEntry(DynamicMapIndex dmi) {
00011     Integer index = (Integer)mapping.get(dmi);
00012 
00013     if(index != null) return index.intValue();
00014 
00015     synchronized(DynamicMap.class) {
00016       index = (Integer)mapping.get(dmi);
00017 
00018       if(index != null) return index.intValue();
00019 
00020       mapping.put(dmi.clone(), new Integer(counter));
00021       return counter++;
00022     }
00023   }  
00024   public static int getEntry(DynamicMapIndex dmi) {
00025     return ((Integer)mapping.get(dmi)).intValue();
00026   }  
00027   public static boolean hasEntry(DynamicMapIndex dmi) {
00028     return mapping.containsKey(dmi);
00029   }  
00030   public static synchronized void reset() {
00031     mapping = new Hashtable();
00032     counter = 0;
00033   }  
00034 }

Generated at Thu Feb 7 06:45:00 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001