View Javadoc

1   //IR.java, created Jul 13, 2004 12:24:59 PM 2004 by mcarbin
2   //Copyright (C) 2004 Michael Carbin
3   //Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package net.sf.bddbddb.ir;
5   
6   import java.util.Collection;
7   import java.util.Map;
8   import jwutil.io.SystemProperties;
9   
10  /***
11   * Interpreter
12   * 
13   * @author mcarbin
14   * @version $Id: Interpreter.java 522 2005-04-29 02:34:44Z joewhaley $
15   */
16  public abstract class Interpreter {
17      boolean TRACE = SystemProperties.getProperty("traceinterpreter") != null;
18      IR ir;
19      OperationInterpreter opInterpreter;
20      Map/*<Relation,RelationStats>*/ relationStats;
21      Map/*<IterationList,LoopStats>*/ loopStats;
22  
23      public abstract void interpret();
24      public static class RelationStats {
25          public int size;
26  
27          public RelationStats() {
28              size = 0;
29          }
30  
31          /***
32           * @param that
33           * @return the result of joining
34           */
35          public RelationStats join(RelationStats that) {
36              RelationStats result = new RelationStats();
37              result.size = (this.size > that.size) ? this.size : that.size;
38              return result;
39          }
40  
41          public RelationStats copy() {
42              RelationStats result = new RelationStats();
43              result.size = this.size;
44              return result;
45          }
46  
47          /* (non-Javadoc)
48           * @see java.lang.Object#equals(java.lang.Object)
49           */
50          public boolean equals(Object o) {
51              if (o instanceof RelationStats) {
52                  return this.size == ((RelationStats) o).size;
53              }
54              return false;
55          }
56  
57          /* (non-Javadoc)
58           * @see java.lang.Object#hashCode()
59           */
60          public int hashCode() {
61              return this.size;
62          }
63          
64          public String toString() {
65              return "size: " + Double.toString(size);
66          }
67      }
68      public static class LoopStats {
69          Collection/* Relation */inputRelations;
70      }
71  }