-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIff.java
27 lines (23 loc) · 1 KB
/
Iff.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
///////////////////////////////////////////////////////
//CSE 205: Class #: 17566 / Miller: M W 4:35-5:50 //
//Assignment: #06 //
//Author(s): Trevor Kann - ID:1210780334 //
//Description: Iff node module //
///////////////////////////////////////////////////////
import java.util.Hashtable;
public class Iff extends Node {
private Node subNode1 = null, subNode2 = null;
private static Parser parser = new Parser();
public Iff(String toParse1, String toParse2){//makes a new iff node
subNode1 = parser.parse(toParse1);
subNode2 = parser.parse(toParse2);
}
@Override
public Boolean evaluate(Hashtable<String, Boolean> tValues) {//returns true if either both are true or both are false, recursively checks
return ( (subNode1.evaluate(tValues) & subNode2.evaluate(tValues)) || (!subNode1.evaluate(tValues) & !subNode2.evaluate(tValues)) );
}
@Override
public Boolean isAtomic() {
return false;
}
}