Closed GoogleCodeExporter closed 8 years ago
These two classes PreMinusOperator and SubtractOperator define the behaviour
for the '-' operator:
You can modify the createFunction() methods in these two classes like this:
org.matheclipse.parser.client.operator.PreMinusOperator
...
public ASTNode createFunction(final IParserFactory factory,
final ASTNode argument) {
return factory.createFunction(factory.createSymbol("Minus"), argument);
}
...
org.matheclipse.parser.client.operator.SubtractOperator
...
public ASTNode createFunction(final IParserFactory factory, final ASTNode lhs,
final ASTNode rhs) {
return factory.createFunction(factory.createSymbol("Subtract"), lhs, rhs);
}
...
Original comment by axelclk@gmail.com
on 2 Sep 2011 at 7:14
Thanks a lot! your suggestion works.
I did the same kind of modification with the DivideOperator :
org.matheclipse.parser.client.operator.DivideOperator
...
public ASTNode createFunction(final IParserFactory factory,
final ASTNode lhs, final ASTNode rhs) {
factory.createInteger(-1)));
if (rhs instanceof IntegerNode && lhs instanceof IntegerNode) {
return new FractionNode((IntegerNode) lhs, (IntegerNode) rhs);
}
return factory.createFunction(factory.createSymbol("Divide"),lhs,rhs);
}
Original comment by ponroy...@gmail.com
on 5 Sep 2011 at 11:31
Original comment by axelclk@gmail.com
on 5 Sep 2011 at 5:02
Original issue reported on code.google.com by
ponroy...@gmail.com
on 1 Sep 2011 at 7:57