jmathlib.core.interpreter
Class Interpreter

java.lang.Object
  extended by jmathlib.core.interpreter.Interpreter

public class Interpreter
extends java.lang.Object

This is the main interface for the program. Any interface to the MathLib program would access it through the functions exposed by this class.


Field Summary
 GlobalValues globals
          global pointers and values
private  JMathLibOutput outputPanel
          panel used for displaying text
(package private)  boolean runningStandalone
          Is the class being called from an application or an applet
 boolean throwErrorsB
          for testing purposes additional throwing of errors can be enables
 
Constructor Summary
Interpreter(boolean _runningStandalone)
          Constructs the interpreter and sets the constants
 
Method Summary
 void displayText(java.lang.String text)
          displays a string to the outputPanel
 java.lang.String executeExpression(java.lang.String expression)
          execute a single line.
 boolean[][] getArrayValueBoolean(java.lang.String name)
           
 double[][] getArrayValueIm(java.lang.String name)
          get the imaginary values of a an array
 double[][] getArrayValueRe(java.lang.String name)
          get the real values of a an array
 JMathLibOutput getOutputPanel()
          returns the panel to write any text to
 java.lang.String getResult()
          Return the result of the last calculation
 boolean getScalarValueBoolean(java.lang.String name)
           
 double getScalarValueIm(java.lang.String name)
          get the imaginary part of a scalar variable
 double getScalarValueRe(java.lang.String name)
          get the real part of a scalar variable
 java.lang.String getString(java.lang.String name)
          Return the result of the last calculation
 void save()
          saves the variable list
 void setArray(java.lang.String name, double[][] valueRe, double[][] valueIm)
          Store an array variable in jmathlib's workspace
 void setOutputPanel(JMathLibOutput _outputPanel)
          sets the panel to write any text to
 void setScalar(java.lang.String name, double valueRe, double valueIm)
          store a scalar variable in jmathlib's workspace
 void setStatusText(java.lang.String _status)
          write status message to GUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runningStandalone

boolean runningStandalone
Is the class being called from an application or an applet


outputPanel

private JMathLibOutput outputPanel
panel used for displaying text


globals

public GlobalValues globals
global pointers and values


throwErrorsB

public boolean throwErrorsB
for testing purposes additional throwing of errors can be enables

Constructor Detail

Interpreter

public Interpreter(boolean _runningStandalone)
Constructs the interpreter and sets the constants

Parameters:
_runningStandalone - = true if this is being used from an application
Method Detail

setOutputPanel

public void setOutputPanel(JMathLibOutput _outputPanel)
sets the panel to write any text to

Parameters:
_outputPanel - = the panel to write to, must implement the MathLibOutput interface

getOutputPanel

public JMathLibOutput getOutputPanel()
returns the panel to write any text to

Returns:
outputPanel = the panel to write to

setStatusText

public void setStatusText(java.lang.String _status)
write status message to GUI

Parameters:
_status -

displayText

public void displayText(java.lang.String text)
displays a string to the outputPanel

Parameters:
text - = the text to display

save

public void save()
saves the variable list


executeExpression

public java.lang.String executeExpression(java.lang.String expression)
execute a single line.

Parameters:
expression - = the line to execute
Returns:
the result as a String

getScalarValueRe

public double getScalarValueRe(java.lang.String name)
get the real part of a scalar variable

Parameters:
name - = name of the scalar variable
Returns:
numerical value of the variable

getScalarValueIm

public double getScalarValueIm(java.lang.String name)
get the imaginary part of a scalar variable

Parameters:
name - = name of the scalar variable
Returns:
numerical value of the variable

getScalarValueBoolean

public boolean getScalarValueBoolean(java.lang.String name)
Parameters:
name -
Returns:

getArrayValueRe

public double[][] getArrayValueRe(java.lang.String name)
get the real values of a an array

Parameters:
name - = name of the array
Returns:
numerical value of the array

getArrayValueIm

public double[][] getArrayValueIm(java.lang.String name)
get the imaginary values of a an array

Parameters:
name - = name of the array
Returns:
numerical value of the array

getArrayValueBoolean

public boolean[][] getArrayValueBoolean(java.lang.String name)
Parameters:
name -
Returns:

setScalar

public void setScalar(java.lang.String name,
                      double valueRe,
                      double valueIm)
store a scalar variable in jmathlib's workspace

Parameters:
name - = name of the scalar
valueRe - = real value of the scalar
valueIM - = imaginary value of the scalar

setArray

public void setArray(java.lang.String name,
                     double[][] valueRe,
                     double[][] valueIm)
Store an array variable in jmathlib's workspace

Parameters:
name - = name of the array
valueRe - = real values of the array
valueIM - = imaginary values of the array

getResult

public java.lang.String getResult()
Return the result of the last calculation

Returns:
a string containing the last result

getString

public java.lang.String getString(java.lang.String name)
Return the result of the last calculation

Returns:
a string containing the last result

FOOTER

BOTTOM