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.
41 lines
617 B
41 lines
617 B
11 years ago
|
package net.mightypork.rcalc.operations;
|
||
|
|
||
|
|
||
|
import net.mightypork.rcalc.IEvaluable;
|
||
|
import net.mightypork.rcalc.numbers.Fraction;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Exponentiation
|
||
|
*
|
||
|
* @author Ondrej Hruska
|
||
|
*/
|
||
|
public class OperationPower extends BinaryOperation {
|
||
|
|
||
|
/**
|
||
|
* Create exponentiation
|
||
|
*
|
||
|
* @param left left operand
|
||
|
* @param right right operand
|
||
|
*/
|
||
|
public OperationPower(IEvaluable left, IEvaluable right) {
|
||
|
|
||
|
super(left, right);
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public Fraction evaluate() {
|
||
|
|
||
|
return left.evaluate().power(right.evaluate());
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public String toString() {
|
||
|
|
||
|
return "POW{" + left + "," + right + "}";
|
||
|
}
|
||
|
|
||
|
}
|