-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAndExp.java
More file actions
27 lines (21 loc) · 719 Bytes
/
Copy pathAndExp.java
File metadata and controls
27 lines (21 loc) · 719 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
package behavioral.interpreter;
public class AndExp extends BooleanExp {
private BooleanExp operand1;
private BooleanExp operand2;
public AndExp(BooleanExp operand1, BooleanExp operand2) {
this.operand1 = operand1;
this.operand2 = operand2;
}
@Override
public boolean Evaluate(Context context) {
return operand1.Evaluate(context) && operand2.Evaluate(context);
}
@Override
public BooleanExp Replace(String key, BooleanExp expression) {
return new AndExp(operand1.Replace(key, expression), operand2.Replace(key, expression));
}
@Override
public BooleanExp Copy() {
return new AndExp(operand1.Copy(), operand2.Copy());
}
}