6 Hashtable methodnumber;
7 Hashtable classmethodcount;
9 public int getMethodNumber(MethodDescriptor md) {
10 return ((Integer)methodnumber.get(md)).intValue();
13 public int getMethodCount(ClassDescriptor md) {
14 return ((Integer)classmethodcount.get(md)).intValue();
17 public Virtual(State state) {
19 methodnumber=new Hashtable();
20 classmethodcount=new Hashtable();
24 private void doAnalysis() {
25 Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();
26 while(classit.hasNext()) {
27 ClassDescriptor cd=(ClassDescriptor)classit.next();
32 private int numberMethods(ClassDescriptor cd) {
33 if (classmethodcount.containsKey(cd))
34 return ((Integer)classmethodcount.get(cd)).intValue();
35 ClassDescriptor superdesc=cd.getSuperDesc();
38 start=numberMethods(superdesc);
39 for(Iterator it=cd.getMethods();it.hasNext();) {
40 MethodDescriptor md=(MethodDescriptor)it.next();
41 if (md.isStatic()||md.getReturnType()==null)
43 if (superdesc!=null) {
44 Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol());
45 boolean foundmatch=false;
46 for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) {
47 MethodDescriptor matchmd=(MethodDescriptor)matchit.next();
48 if (md.matches(matchmd)) {
49 int num=((Integer)methodnumber.get(matchmd)).intValue();
50 methodnumber.put(md, new Integer(num));
56 methodnumber.put(md, new Integer(start++));
58 methodnumber.put(md, new Integer(start++));
61 classmethodcount.put(cd, new Integer(start));