Revision: 2222 http://qtitools.svn.sourceforge.net/qtitools/?rev=2222&view=rev Author: davemckain Date: 2010-01-25 19:01:35 +0000 (Mon, 25 Jan 2010) Log Message: ----------- Following the Edinburgh tech meeting on 25/01/10, simplification is now turned off when passing variables to Maxima and querying their values. (This change is new and will probably get tidied up a bit but I'll wait for feedback first.) Modified Paths: -------------- MathAssessTools/trunk/MathAssessTools-Glue/src/main/java/org/qtitools/mathassess/tools/qticasbridge/maxima/QTIMaximaSession.java Modified: MathAssessTools/trunk/MathAssessTools-Glue/src/main/java/org/qtitools/mathassess/tools/qticasbridge/maxima/QTIMaximaSession.java =================================================================== --- MathAssessTools/trunk/MathAssessTools-Glue/src/main/java/org/qtitools/mathassess/tools/qticasbridge/maxima/QTIMaximaSession.java 2010-01-25 13:38:57 UTC (rev 2221) +++ MathAssessTools/trunk/MathAssessTools-Glue/src/main/java/org/qtitools/mathassess/tools/qticasbridge/maxima/QTIMaximaSession.java 2010-01-25 19:01:35 UTC (rev 2222) @@ -296,7 +296,7 @@ /* Then do the appropriate Maxima call */ try { - rawMaximaSession.executeRaw(variableIdentifier + ": " + maximaValue + "$"); + rawMaximaSession.executeRaw("simp:false$" + variableIdentifier + ": " + maximaValue + "$ simp:true$"); } catch (MaximaTimeoutException e) { /* This shouldn't happen here! */ @@ -335,6 +335,9 @@ checkVariableIdentifier(variableIdentifier); ConstraintUtilities.ensureNotNull(resultClass, "resultClass"); try { + /* Turn simplification off */ + rawMaximaSession.executeRaw("simp:false$"); + /* First of all, we'll check whether the variable is actually defined by asking Maxima * to return it. We will use the "string(var);" form as me may end up picking this * apart to parse the actual value later. @@ -369,6 +372,17 @@ throw new QTICASBridgeException("Unexpected timeout occurred while extracting the value of variable " + variableIdentifier, e); } + finally { + /* Turn simplification back on */ + try { + rawMaximaSession.executeRaw("simp:true$"); + } + catch (MaximaTimeoutException e) { + /* FIXME: All bets are off now as Maxima is probably in a bad state now... perhaps need to refactor slightly? */ + throw new QTICASBridgeException("Unexpected timeout occurred while resetting simp flag back to true" + + variableIdentifier, e); + } + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |