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

BuchiSet.java

00001 package gov.nasa.arc.ase.jpf;
00002 
00003 import gov.nasa.arc.ase.util.Debug;
00004 
00005 public class BuchiSet {
00006 //#ifdef BUCHI
00007   int[] data;
00008   
00009 //#endif BUCHI
00010   public BuchiSet() {
00011     data = new int[0];
00012   }  
00013   public void add(int b, int v) {
00014     int l = data.length;
00015     int[] newdata = new int[l + 2];
00016     System.arraycopy(data, 0, newdata, 0, l);
00017     data = newdata;
00018 
00019     Engine.getJPF().status.storageMemory += 8;
00020 
00021     data[l] = b;
00022     data[l+1] = v;
00023   }  
00024   public int get(int b) {
00025     for(int i = 0, l = data.length; i < l; i += 2)
00026       if(data[i] == b) return data[i+1];
00027 
00028     return LTL.NEW;
00029   }  
00030   public void replace(int b, int v) {
00031     for(int i = 0, l = data.length; i < l; i += 2)
00032       if(data[i] == b) {
00033     data[i+1] = v;
00034     return;
00035       }
00036 
00037     Debug.println(Debug.WARNING, "BuchiSet.replace(II)V failed");
00038   }  
00039   public int size() {
00040     return data.length * 4;
00041   }  
00042   public String toString() {
00043     StringBuffer sb = new StringBuffer();
00044     int sz = data.length;
00045 
00046     sb.append("buchiset[");
00047     sb.append(sz);
00048     sb.append("] = { ");
00049     for(int i = 0; i < sz; i++) {
00050       if(i != 0) sb.append(", ");
00051       if(i % 2 == 1)
00052     sb.append(data[i]);
00053       else
00054     sb.append(Integer.toHexString(data[i]));
00055     }
00056     sb.append(" }");
00057 
00058     return sb.toString();
00059   }  
00060 }

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