1
2
3
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 * Save
13 *
14 * @author John Whaley
15 * @version $Id: Save.java 328 2004-10-16 02:45:30Z joewhaley $
16 */
17 public class Save extends HighLevelOperation {
18 Relation r;
19 String fileName;
20 boolean tuples;
21
22 /***
23 * @param r
24 */
25 public Save(Relation r, String fileName, boolean tuples) {
26 super();
27 this.r = r;
28 this.fileName = fileName;
29 this.tuples = tuples;
30 }
31
32
33
34
35
36
37 public Object visit(HighLevelOperationVisitor i) {
38 return i.visit(this);
39 }
40
41
42
43
44
45
46 public String toString() {
47 return "save(" + r.toString() + ")";
48 }
49
50
51
52
53
54
55 public String getExpressionString() {
56 return toString();
57 }
58
59
60
61
62
63
64 public Relation getRelationDest() {
65 return null;
66 }
67
68
69
70
71
72
73 public List getSrcs() {
74 return Collections.singletonList(r);
75 }
76
77 /***
78 * @return Returns the source relation.
79 */
80 public Relation getSrc() {
81 return r;
82 }
83
84 public Operation copy() {
85 return new Save(r, fileName, tuples);
86 }
87
88
89
90
91
92
93
94 public void replaceSrc(Relation r_old, Relation r_new) {
95 if (r == r_old) r = r_new;
96 }
97
98
99
100
101
102
103 public void setRelationDest(Relation r0) {
104 }
105
106 /***
107 * @return the file name being saved
108 */
109 public String getFileName() {
110 return fileName;
111 }
112
113 /***
114 * @return whether we are saving tuples
115 */
116 public boolean isTuples() {
117 return tuples;
118 }
119 }