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

Store.java

00001 package gov.nasa.arc.ase.jpf;
00002 
00003 import gov.nasa.arc.ase.util.Cache;
00004 import gov.nasa.arc.ase.util.Debug;
00005 import java.util.Hashtable;
00006 
00007 public class Store implements iStore {
00008   private static Boolean OnStack = new Boolean(true);
00009   private static Boolean OffStack = new Boolean(false);
00010   private Hashtable store = new Hashtable();
00011 
00012 //#endif BUCHI
00013   public Store() {
00014   }  
00015 //#ifdef BUCHI
00016   public BuchiSet BuchiGet(iSystemState state) {
00017     Object o = state.getData();
00018 
00019 //#ifdef DEBUG
00020 
00021 //#endif DEBUG
00022     BuchiSet buchis = (BuchiSet)store.get(o);
00023 
00024     if(buchis == null) {
00025       buchis = new BuchiSet();
00026       store.put(o, buchis);
00027       Engine.getJPF().status.unique++;
00028       Engine.getJPF().status.storageMemory += state.getDataSize(o);
00029     }
00030 
00031     return buchis;
00032   }  
00033   public int check(iSystemState state) {
00034     return check(state.getData());
00035   }  
00036   public int check(Object o) {
00037     if(store.containsKey(o)) {
00038       Boolean b = (Boolean)store.get(o);
00039 
00040       if(b.booleanValue())
00041     return ONSTACK;
00042 
00043       return OFFSTACK;
00044     }
00045 
00046     return NEW;
00047   }  
00048   public void initial(iVirtualMachine vm) {
00049 //#ifdef BUCHI
00050     if(Engine.options.buchi != null) return;
00051 //#endif BUCHI
00052 
00053     iSystemState state = vm.getSystemState();
00054     Object o = state.getData();
00055 
00056     store.put(o, OnStack);
00057 
00058     Engine.getJPF().status.storageMemory += state.getDataSize(o);
00059   }  
00060   public void offStack(iSystemState state) {
00061 //#ifdef BUCHI
00062     if(Engine.options.buchi != null) return;
00063 //#endif BUCHI
00064     store.put(state.getData(), OffStack);
00065   }  
00066   public int put(iVirtualMachine vm) {
00067     iSystemState state = vm.getSystemState();
00068     Object o = state.getData();
00069     int r = check(o);
00070 
00071     if(r == NEW) {
00072       store.put(o, OnStack);
00073       Engine.getJPF().status.storageMemory += state.getDataSize(o);
00074     }
00075 
00076     return r;
00077   }  
00078   public int put2(iSystemState state) {
00079     return check(state.getData());
00080   }  
00081 }

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