Back to project page MentalMathX.
The source code is released under:
GNU General Public License
If you think the Android project MentalMathX listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.schlingel.bplaced.mentalmathx.math; /* www.j a v a 2s .com*/ /** * Created by zombie on 27.06.14. */ public class Calculation implements Term { private Term leftHandTerm; private Term rightHandTerm; private Operator operator; @Override public int value() { return operator.apply(leftHandTerm.value(), rightHandTerm.value()); } @Override public String toString() { return String.format("(%s %s %s)", leftHandTerm.toString(), operator.toString(), rightHandTerm.toString()); } public void setOperator(Operator operator) { this.operator = operator; } public Operator getOperator() { return operator; } public void setRightHandTerm(Term rightHandTerm) { this.rightHandTerm = rightHandTerm; } public Term getRightHandTerm() { return rightHandTerm; } public void setLeftHandTerm(Term leftHandTerm) { this.leftHandTerm = leftHandTerm; } public Term getLeftHandTerm() { return leftHandTerm; } }