-
Notifications
You must be signed in to change notification settings - Fork 2
/
Scan.java
62 lines (54 loc) · 1.26 KB
/
Scan.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
57
58
59
60
61
62
package sjdb;
import java.util.List;
import java.util.Iterator;
/**
* This class implements a Scan operator that feeds a NamedRelation into
* a query plan.
* @author nmg
*/
public class Scan extends Operator {
/**
* The named relation to be scanned
*/
private NamedRelation relation;
/**
* Create a new scan of a given named relation
* @param relation Named relation to be scanned
*/
public Scan(NamedRelation relation) {
this.relation = relation;
this.output = new Relation(relation.getTupleCount());
Iterator<Attribute> iter = relation.getAttributes().iterator();
while (iter.hasNext()) {
this.output.addAttribute(new Attribute(iter.next()));
}
}
/* (non-Javadoc)
* @see sjdb.Operator#getInputs()
*/
@Override
public List<Operator> getInputs() {
// TODO Auto-generated method stub
return null;
}
/**
* Return the named relation to be scanned
* @return Named relation to be scanned
*/
public Relation getRelation() {
return this.relation;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return this.relation.toString();
}
/* (non-Javadoc)
* @see sjdb.Operator#accept(sjdb.OperatorVisitor)
*/
public void accept(PlanVisitor visitor) {
visitor.visit(this);
}
}