View Javadoc

1   // Load.java, created Jul 4, 2004 3:47:13 AM by joewhaley
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 net.sf.bddbddb.Relation;
9   import net.sf.bddbddb.ir.Operation;
10  
11  /***
12   * Load
13   * 
14   * @author John Whaley
15   * @version $Id: Load.java 328 2004-10-16 02:45:30Z joewhaley $
16   */
17  public class Load extends HighLevelOperation {
18      Relation r0;
19      String fileName;
20      boolean tuples;
21  
22      /***
23       * @param r0
24       */
25      public Load(Relation r0, String fileName, boolean tuples) {
26          super();
27          this.r0 = r0;
28          this.fileName = fileName;
29          this.tuples = tuples;
30      }
31  
32      /*
33       * (non-Javadoc)
34       * 
35       * @see net.sf.bddbddb.ir.Operation#visit(net.sf.bddbddb.ir.HighLevelOperationVisitor)
36       */
37      public Object visit(HighLevelOperationVisitor i) {
38          return i.visit(this);
39      }
40  
41      /*
42       * (non-Javadoc)
43       * 
44       * @see java.lang.Object#toString()
45       */
46      public String toString() {
47          return r0.toString() + " = load(\"" + fileName + "\")";
48      }
49  
50      /*
51       * (non-Javadoc)
52       * 
53       * @see net.sf.bddbddb.ir.Operation#getExpressionString()
54       */
55      public String getExpressionString() {
56          return "load(" + r0.toString() + ",\"" + fileName + "\")";
57      }
58  
59      /*
60       * (non-Javadoc)
61       * 
62       * @see net.sf.bddbddb.ir.Operation#getDest()
63       */
64      public Relation getRelationDest() {
65          return r0;
66      }
67  
68      /*
69       * (non-Javadoc)
70       * 
71       * @see net.sf.bddbddb.ir.Operation#getSrcs()
72       */
73      public List getSrcs() {
74          return Collections.EMPTY_LIST;
75      }
76  
77      public Operation copy() {
78          return new Load(r0, fileName, tuples);
79      }
80  
81      /*
82       * (non-Javadoc)
83       * 
84       * @see net.sf.bddbddb.ir.Operation#replaceSrc(net.sf.bddbddb.Relation,
85       *      net.sf.bddbddb.Relation)
86       */
87      public void replaceSrc(Relation r_old, Relation r_new) {
88      }
89  
90      /*
91       * (non-Javadoc)
92       * 
93       * @see net.sf.bddbddb.ir.Operation#setRelationDest(net.sf.bddbddb.Relation)
94       */
95      public void setRelationDest(Relation r0) {
96          this.r0 = r0;
97      }
98  
99      /***
100      * @return  the filename
101      */
102     public String getFileName() {
103         return fileName;
104     }
105 
106     /***
107      * @return  whether it is tuples
108      */
109     public boolean isTuples() {
110         return tuples;
111     }
112 }