-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForEachNode.java
More file actions
32 lines (27 loc) · 785 Bytes
/
ForEachNode.java
File metadata and controls
32 lines (27 loc) · 785 Bytes
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
package icsi311;
public class ForEachNode extends StatementNode{
private Node Condition;
private BlockNode Block;
// If true, then don't print out block. This is to avoid erorrs
private boolean emptyBlock;
public ForEachNode(Node c, BlockNode b) {
Condition = c;
Block = b;
}
public ForEachNode(Node c){
Condition = c;
emptyBlock = true;
}
public Node getCondition(){
return Condition;
}
public BlockNode getBlock(){
return Block;
}
public String toString(){
// If true, don't call or mention block
if(emptyBlock == true)
return "\nforEach(" + Condition + "){}";
return "\nforEach(" + Condition + "){\n\t" + Block.toString() + "\n}\n";
}
}