00001 package gov.nasa.arc.ase.jpf.jvm.runtime;
00002
00003 import gov.nasa.arc.ase.jpf.*;
00004 import gov.nasa.arc.ase.jpf.jvm.*;
00005 import java.util.*;
00006 import gov.nasa.arc.ase.util.Debug;
00007
00008 public class AccessList {
00009
00010 private List access_list = new ArrayList();
00011
00012
00013 private void addCallChain(ThreadInfo th,int kind) {
00014
00015 Access access = new Access(th);
00016 access_list.add(access);
00017 switch (kind) {
00018 case 0 : access.addInit() ;break;
00019 case 1 : access.addRead() ;break;
00020 case 2 : access.addWrite();break;
00021 }
00022
00023 int idx = th.depth();
00024 while(idx > 0) {
00025 idx--;
00026
00027 access.addCall(
00028 th.getCurrentClass(idx).getClassName(),
00029 th.getCurrentMethod(idx).getMethodName(),
00030 th.getCurrentLine(idx));
00031 }
00032 }
00033 public void addInit(ThreadInfo thread) {
00034 addCallChain(thread,0);
00035 }
00036 public void addRead(ThreadInfo thread) {
00037 addCallChain(thread,1);
00038 }
00039 public void addWrite(ThreadInfo thread) {
00040 addCallChain(thread,2);
00041 }
00042 public Iterator getIterator() {
00043 return access_list.iterator();
00044 }
00045 public void print() {
00046 Iterator access_list_it = access_list.iterator();
00047 while (access_list_it.hasNext())
00048 ((Access)access_list_it.next()).print();
00049 }
00050 }