1   /* Ephemera.java */
2   package org.quilt.cover.stmt;
3   
4   import java.util.List;
5   import java.util.Vector;
6   
7   /***
8    * 
9    * @author < a href="mailto:jddixon@users.sourceforge.net">Jim Dixon</a>
10   */
11  
12  class Ephemera {
13  
14      /*** Name of the class we are collecting information on */
15      private String className;
16  
17      /*** Number of counters added so far */
18      private static int counterCount;
19  
20      /*** Counter index at the end of each instrumented method */
21      private List methodEnds;
22  
23      /*** Names of methods that have been instrumented */
24      private List methodNames;
25      
26      /*** Constructor, initializes class name */
27      Ephemera (String name) {
28          className    = name;
29          counterCount = 0;
30          methodEnds   = new Vector();
31          methodNames  = new Vector();
32      }
33              
34      /*** 
35       * Used by GraphXformers to report the cumulative number of
36       * counter vertices added after instrumenting method n.
37       *
38       * @param n     Method index.
39       * @param count Cumulative number of counter vertices added.
40       */
41      void setEndCount (String meName, int count) {
42          if (meName == null) {
43              throw new IllegalArgumentException("null name");
44          }
45          if (count < 0) {
46              throw new IllegalArgumentException("negative count");
47          }
48          if (count < counterCount) {
49              System.out.println("Ephemera.setEndCount WARNING: "
50                  + "count now " + counterCount 
51                  + " but resetting to " + count);
52          }
53          if (methodEnds == null || methodNames == null) {
54              System.out.println(
55              "Ephemera.setEndCount INTERNAL ERROR: methodEnds/Names is null");
56          } else {
57              methodNames.add(meName);
58              methodEnds.add(new Integer(count));
59          }
60          counterCount = count;
61      }
62      /*** @return class name for debugging */
63      String getClassName() {
64          return className;
65      }
66      /*** @return cumulative counter count */
67      int getCounterCount() {
68          return counterCount;
69      }
70      /*** @return a list of names of methods seen so far */
71      List getMethodNames () {
72          return methodNames;
73      }
74      /*** @return a list of cumulative counter counts after instrumenting */
75      List getMethodEnds () {
76          return methodEnds;
77      }
78  }
This page was automatically generated by Maven