[Mathlib-commitlog] SF.net SVN: mathlib: [349] JMathLib/trunk/src/jmathlib/core/tokens/ MulDivOpera
Status: Beta
Brought to you by:
st_mueller
From: <st_...@us...> - 2007-11-10 18:56:43
|
Revision: 349 http://mathlib.svn.sourceforge.net/mathlib/?rev=349&view=rev Author: st_mueller Date: 2007-11-10 10:56:39 -0800 (Sat, 10 Nov 2007) Log Message: ----------- removed symbolic code Modified Paths: -------------- JMathLib/trunk/src/jmathlib/core/tokens/MulDivOperatorToken.java Modified: JMathLib/trunk/src/jmathlib/core/tokens/MulDivOperatorToken.java =================================================================== --- JMathLib/trunk/src/jmathlib/core/tokens/MulDivOperatorToken.java 2007-11-10 18:54:48 UTC (rev 348) +++ JMathLib/trunk/src/jmathlib/core/tokens/MulDivOperatorToken.java 2007-11-10 18:56:39 UTC (rev 349) @@ -8,8 +8,8 @@ public class MulDivOperatorToken extends BinaryOperatorToken { /**constant values*/ - static public final MulDivOperatorToken divide = new MulDivOperatorToken('/'); - static public final MulDivOperatorToken multiply = new MulDivOperatorToken('*'); + //static public final MulDivOperatorToken divide = new MulDivOperatorToken('/'); + //static public final MulDivOperatorToken multiply = new MulDivOperatorToken('*'); /**Constructor taking the operator and priority @@ -35,75 +35,47 @@ if(right == null) right = new DoubleNumberToken(0); - //try - //{ - OperandToken[] ops = {left, right}; //castOperands(left, right); - - //now evaluate op on left and right - if(value == '*') - { - result = ops[0].multiply(ops[1]); - } - else if (value == '/') - { - result = ops[0].divide(ops[1]); - } - else if (value == 'm') - { - //scalar multiplication - result = ops[0].scalarMultiply(ops[1]); - } - else if (value == 'd') - { - //scalar division - result = ops[0].scalarDivide(ops[1]); - } - else if (value == 'L') - { - //left division - result = ops[0].leftDivide(ops[1]); - } - else if (value == 'l') - { - //scalar left division - result = ops[0].scalarLeftDivide(ops[1]); - } - else - Errors.throwMathLibException("MulDiv: do not know operator"); - - if(result == null) - { - //return origional expression - result = new Expression(this, left, right); - } - //} - //catch(Exception exception) - //{ - // Errors.throwMathLibException("exception in muldiv"); - // result = null; - //} + OperandToken[] ops = {left, right}; //castOperands(left, right); + + //now evaluate op on left and right + if(value == '*') + { + result = ops[0].multiply(ops[1]); + } + else if (value == '/') + { + result = ops[0].divide(ops[1]); + } + else if (value == 'm') + { + //scalar multiplication + result = ops[0].scalarMultiply(ops[1]); + } + else if (value == 'd') + { + //scalar division + result = ops[0].scalarDivide(ops[1]); + } + else if (value == 'L') + { + //left division + result = ops[0].leftDivide(ops[1]); + } + else if (value == 'l') + { + //scalar left division + result = ops[0].scalarLeftDivide(ops[1]); + } + else + Errors.throwMathLibException("MulDiv: do not know operator"); + if(result == null) + { + //return origional expression + result = new Expression(this, left, right); + } + return result; } - /**@return a string containing the operator and it's operands*/ - /*public String toString(OperandToken[] operands) - { - if(value == '*') - { - if(operands[1] instanceof VariableToken) - { - return operands[0].toString() + " " + operands[1].toString(); - } - - if(operands[0] instanceof VariableToken) - { - return operands[1].toString() + " " +operands[0].toString(); - } - - return "(" + operands[0] + " " + value + " " + operands[1] + ")"; - } - else - return "(" + operands[0] + " " + value + " " + operands[1] + ")"; - }*/ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |