View Javadoc

1   // Free.java, created Jul 1, 2004 12:42:19 PM 2004 by jwhaley
2   // Copyright (C) 2004 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package net.sf.bddbddb.ir.highlevel;
5   
6   import java.util.Collections;
7   import java.util.List;
8   import jwutil.util.Assert;
9   import net.sf.bddbddb.Relation;
10  import net.sf.bddbddb.ir.Operation;
11  
12  /***
13   * Free
14   * 
15   * @author jwhaley
16   * @version $Id: Free.java 328 2004-10-16 02:45:30Z joewhaley $
17   */
18  public class Free extends HighLevelOperation {
19      Relation r;
20  
21      /***
22       * @param r
23       */
24      public Free(Relation r) {
25          super();
26          this.r = r;
27      }
28  
29      /*
30       * (non-Javadoc)
31       * 
32       * @see net.sf.bddbddb.ir.Operation#visit(net.sf.bddbddb.ir.HighLevelOperationVisitor)
33       */
34      public Object visit(HighLevelOperationVisitor i) {
35          return i.visit(this);
36      }
37  
38      /*
39       * (non-Javadoc)
40       * 
41       * @see java.lang.Object#toString()
42       */
43      public String toString() {
44          return "free(" + r.toString() + ")";
45      }
46  
47      /*
48       * (non-Javadoc)
49       * 
50       * @see net.sf.bddbddb.ir.Operation#getExpressionString()
51       */
52      public String getExpressionString() {
53          return toString();
54      }
55  
56      /*
57       * (non-Javadoc)
58       * 
59       * @see net.sf.bddbddb.ir.Operation#getDest()
60       */
61      public Relation getRelationDest() {
62          return null;
63      }
64  
65      /*
66       * (non-Javadoc)
67       * 
68       * @see net.sf.bddbddb.ir.Operation#getSrcs()
69       */
70      public List getSrcs() {
71          return Collections.singletonList(r);
72      }
73  
74      /***
75       * @return Returns the source relation.
76       */
77      public Relation getSrc() {
78          return r;
79      }
80  
81      public Operation copy() {
82          return new Free(r);
83      }
84  
85      /*
86       * (non-Javadoc)
87       * 
88       * @see net.sf.bddbddb.ir.Operation#replaceSrc(net.sf.bddbddb.Relation,
89       *      net.sf.bddbddb.Relation)
90       */
91      public void replaceSrc(Relation r_old, Relation r_new) {
92          if (r == r_old) r = r_new;
93      }
94  
95      /*
96       * (non-Javadoc)
97       * 
98       * @see net.sf.bddbddb.ir.Operation#setRelationDest(net.sf.bddbddb.Relation)
99       */
100     public void setRelationDest(Relation r0) {
101         Assert.UNREACHABLE("");
102     }
103 }