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
620 B
40 lines
620 B
package net.mightypork.rcalc.operations;
|
|
|
|
|
|
import net.mightypork.rcalc.IEvaluable;
|
|
import net.mightypork.rcalc.numbers.Fraction;
|
|
|
|
|
|
/**
|
|
* Subtraction
|
|
*
|
|
* @author Ondrej Hruska
|
|
*/
|
|
public class OperationSubtract extends BinaryOperation {
|
|
|
|
/**
|
|
* Create subtraction
|
|
*
|
|
* @param left left operand
|
|
* @param right right operand
|
|
*/
|
|
public OperationSubtract(IEvaluable left, IEvaluable right) {
|
|
|
|
super(left, right);
|
|
}
|
|
|
|
|
|
@Override
|
|
public Fraction evaluate() {
|
|
|
|
return left.evaluate().subtract(right.evaluate());
|
|
}
|
|
|
|
|
|
@Override
|
|
public String toString() {
|
|
|
|
return "SUB{" + left + "," + right + "}";
|
|
}
|
|
|
|
}
|
|
|