-
Notifications
You must be signed in to change notification settings - Fork 2
/
Project.java
56 lines (47 loc) · 1.19 KB
/
Project.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package sjdb;
import java.util.List;
import java.util.Iterator;
/**
* This class represents a Project operator.
* @author nmg
*/
public class Project extends UnaryOperator {
private List<Attribute> attributes;
/**
* Create a new project operator.
* @param input Child operator
* @param attributes List of attributes to be projected
*/
public Project(Operator input, List<Attribute> attributes) {
super(input);
this.attributes = attributes;
}
/**
* Return the list of attributes projected by this operator
* @return List of attributes to be projected
*/
public List<Attribute> getAttributes() {
return this.attributes;
}
/* (non-Javadoc)
* @see sjdb.UnaryOperator#accept(sjdb.OperatorVisitor)
*/
public void accept(PlanVisitor visitor) {
// depth-first traversal - accept the
super.accept(visitor);
visitor.visit(this);
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
String ret = "PROJECT [";
Iterator<Attribute> iter = this.attributes.iterator();
ret += iter.next().getName();
while (iter.hasNext()) {
ret += "," + iter.next().getName();
}
ret += "] (" + getInput().toString() + ")";
return ret;
}
}