Java lib for parsing and evaluating simple math expressions, using fractions. This was a seminar project in a Programming class. It is not very useful, but works
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.
rcalc/src/net/mightypork/rcalc/operations/BinaryOperation.java

37 lines
649 B

package net.mightypork.rcalc.operations;
import net.mightypork.rcalc.IEvaluable;
import net.mightypork.rcalc.numbers.Fraction;
/**
* Abstract operation with two operands
*
* @author Ondrej Hruska
*/
public abstract class BinaryOperation extends Operation {
/** Left operand */
protected IEvaluable left = null;
/** Right operand */
protected IEvaluable right = null;
/**
* Create a binary operation
*
* @param left left operand
* @param right right operand
*/
public BinaryOperation(IEvaluable left, IEvaluable right) {
this.left = left;
this.right = right;
}
@Override
public abstract Fraction evaluate();
}