this.left = left;
this.right = right;
}
public Value getValue() {
Value leftValue = left.getValue();
Value rightValue = right.getValue();
Value result;
if (leftValue.isInteger() && rightValue.isInteger()) {
int opResult = leftValue.getInteger() * rightValue.getInteger();
result = new Value(opResult);
} else if (leftValue.isString() && rightValue.isInteger()) {
StringBuilder builder = new StringBuilder();
String leftString = leftValue.getString();
int count = rightValue.getInteger();
for (int i = 0; i < count; i++) {
builder.append(leftString);
}
result = new Value(builder.toString());
} else {
throw EvaluationException
.create("Multiplication operands can not be string.");
}