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(); } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Java Programming: 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<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)
Transcribed Image Text: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)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

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. 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education