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

StaticMap.java

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

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