You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
626 B
40 lines
626 B
package net.mightypork.rcalc.operations;
|
|
|
|
|
|
import net.mightypork.rcalc.IEvaluable;
|
|
import net.mightypork.rcalc.numbers.Fraction;
|
|
|
|
|
|
/**
|
|
* Multiplication
|
|
*
|
|
* @author Ondrej Hruska
|
|
*/
|
|
public class OperationMultiply extends BinaryOperation {
|
|
|
|
/**
|
|
* Create multiplication
|
|
*
|
|
* @param left left operand
|
|
* @param right right operand
|
|
*/
|
|
public OperationMultiply(IEvaluable left, IEvaluable right) {
|
|
|
|
super(left, right);
|
|
}
|
|
|
|
|
|
@Override
|
|
public Fraction evaluate() {
|
|
|
|
return left.evaluate().multiply(right.evaluate());
|
|
}
|
|
|
|
|
|
@Override
|
|
public String toString() {
|
|
|
|
return "MUL{" + left + "," + right + "}";
|
|
}
|
|
|
|
}
|
|
|