Below are BooleanCompareNode.java, VariableReferenceNode.java, IfNode.java, RepeatNode.java, & WhileNode.java. Attached is an image where it's circled in blue all the methods that must be implemented in the java files that are presented below: BooleanCompareNode.java public class BooleanCompareNode extends Node { enum CompareType { eq, ne, lt, gt, le, ge }; CompareType type; Node left; Node right; public BooleanCompareNode(CompareType type, Node left, Node right) { this.type = type; this.left = left; this.right = right; } public String ToString() { return left.toString() + type.toString() + right.toString(); } } VariableReferenceNode.java public class VariableReferenceNode extends Node{ String name; Node arrayIndex; public VariableReferenceNode(String name) { this.name = name; this.arrayIndex = arrayIndex; } public String ToString() { String indexString = (arrayIndex == null) ? "" : "[" + arrayIndex.toString() + "]"; return name + indexString; } public void setIndex(Node indexExpr) { } public String getVariableName() { return null; } } IfNode.java import java.util.ArrayList; import java.util.List; public class IfNode extends Node{ private BooleanCompare condition; private ArrayList statements; private IfNode nextIf; public IfNode(BooleanCompare condition, ArrayList statements, IfNode nextIf) { this.condition = condition; this.statements = statements; this.nextIf = nextIf; } public BooleanCompare getCondition() { return condition; } public ArrayList getStatements() { return statements; } public IfNode getNextIf() { return nextIf; } @Override public String ToString() { StringBuilder sb = new StringBuilder("IfNode: { Condition: "); sb.append(condition.toString()).append(", Statements: ["); for (StatementNode statement : statements) { sb.append(statement.toString()).append(", "); } sb.delete(sb.length() - 2, sb.length()); sb.append("]"); if (nextIf != null) { sb.append(", NextIf: ").append(nextIf.toString()); } sb.append("}"); return sb.toString(); } } RepeatNode.java import java.util.ArrayList; public class RepeatNode extends Node { private BooleanCompare condition; private ArrayList statements; public RepeatNode(BooleanCompare condition, ArrayList statements) { this.condition = condition; this.statements = statements; } BooleanCompare getCondition() { return condition; } public ArrayList getStatements() { return statements; } @Override public String ToString() { StringBuilder sb = new StringBuilder("RepeatNode: { Condition: "); sb.append(condition.toString()).append(", Statements: ["); for (StatementNode statement : statements) { sb.append(statement.toString()).append(", "); } sb.delete(sb.length() - 2, sb.length()); sb.append("]}"); return sb.toString(); } } WhileNode.java import java.util.ArrayList; public class WhileNode extends Node { private BooleanCompare condition; private ArrayList statements; public WhileNode(BooleanCompare condition, ArrayList statements) { this.condition = condition; this.statements = statements; } public BooleanCompare getCondition() { return condition; } public ArrayList getStatements() { return statements; } @Override public String ToString() { StringBuilder sb = new StringBuilder("WhileNode: { Condition: "); sb.append(condition.toString()).append(", Statements: ["); for (StatementNode statement : statements) { sb.append(statement.toString()).append(", "); } sb.delete(sb.length() - 2, sb.length()); sb.append("]}"); return sb.toString(); } }
Java
BooleanCompareNode.java
public class BooleanCompareNode extends Node {
enum CompareType {
eq, ne, lt, gt, le, ge
};
CompareType type;
Node left;
Node right;
public BooleanCompareNode(CompareType type, Node left, Node right) {
this.type = type;
this.left = left;
this.right = right;
}
public String ToString() {
return left.toString() + type.toString() + right.toString();
}
}
VariableReferenceNode.java
public class VariableReferenceNode extends Node{
String name;
Node arrayIndex;
public VariableReferenceNode(String name) {
this.name = name;
this.arrayIndex = arrayIndex;
}
public String ToString() {
String indexString = (arrayIndex == null) ? "" : "[" + arrayIndex.toString() + "]";
return name + indexString;
}
public void setIndex(Node indexExpr) {
}
public String getVariableName() {
return null;
}
}
IfNode.java
import java.util.ArrayList;
import java.util.List;
public class IfNode<BooleanCompare> extends Node{
private BooleanCompare condition;
private ArrayList<StatementNode> statements;
private IfNode nextIf;
public IfNode(BooleanCompare condition, ArrayList<StatementNode> statements, IfNode nextIf) {
this.condition = condition;
this.statements = statements;
this.nextIf = nextIf;
}
public BooleanCompare getCondition() {
return condition;
}
public ArrayList<StatementNode> getStatements() {
return statements;
}
public IfNode getNextIf() {
return nextIf;
}
@Override
public String ToString() {
StringBuilder sb = new StringBuilder("IfNode: { Condition: ");
sb.append(condition.toString()).append(", Statements: [");
for (StatementNode statement : statements) {
sb.append(statement.toString()).append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]");
if (nextIf != null) {
sb.append(", NextIf: ").append(nextIf.toString());
}
sb.append("}");
return sb.toString();
}
}
RepeatNode.java
import java.util.ArrayList;
public class RepeatNode<BooleanCompare> extends Node {
private BooleanCompare condition;
private ArrayList<StatementNode> statements;
public RepeatNode(BooleanCompare condition, ArrayList<StatementNode> statements) {
this.condition = condition;
this.statements = statements;
}
BooleanCompare getCondition() {
return condition;
}
public ArrayList<StatementNode> getStatements() {
return statements;
}
@Override
public String ToString() {
StringBuilder sb = new StringBuilder("RepeatNode: { Condition: ");
sb.append(condition.toString()).append(", Statements: [");
for (StatementNode statement : statements) {
sb.append(statement.toString()).append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]}");
return sb.toString();
}
}
WhileNode.java
import java.util.ArrayList;
public class WhileNode<BooleanCompare> extends Node {
private BooleanCompare condition;
private ArrayList<StatementNode> statements;
public WhileNode(BooleanCompare condition, ArrayList<StatementNode> statements) {
this.condition = condition;
this.statements = statements;
}
public BooleanCompare getCondition() {
return condition;
}
public ArrayList<StatementNode> getStatements() {
return statements;
}
@Override
public String ToString() {
StringBuilder sb = new StringBuilder("WhileNode: { Condition: ");
sb.append(condition.toString()).append(", Statements: [");
for (StatementNode statement : statements) {
sb.append(statement.toString()).append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]}");
return sb.toString();
}
}
![booleanCompare
variable ReferenceNode
mathOpNode
ifNode
forNode
repeatNode
constantNodes
whileNode
assignmentNode
Not handled (0)
Not handled (0)
Not handled (0)
Not handled (0)
Not handled(0)
Not handled (0)
Not handled (0)
Not handled (0)
Not handled(0)
Calls expression(), then compares (5)
Looks up nodes and returns IDT (5)
Calls expression(), then calculates (5)
Calls booleanCompare and chains (10)
Loops over the range and calls
interpretBlock(10)
Calls booleanCompare and
interpretBlock correctly (5)
Returns a new IDT (5)
Calls booleanCompare and
interpretBlock correctly (5)
calls expression() and replaces the IDT
entry for the variable(5)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe7ddc10c-4670-40fd-b02c-6a60c5fcc2f2%2F8ce75973-d616-44ab-b802-527cb5f307db%2F4pvq6ga_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Where are the methods being used that I circled in the rubric? I don't see anything. I added all the needed java files for the methods to be added for each java file shown above. Which is why I circled the methods. Please fix this and show me the methods being used that I circled for the java files.
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)