logo


math
Class Equation

java.lang.Object
  extended by math.Equation

public class Equation
extends java.lang.Object

Complex equation model

Originally of the ResMedii project

This class uses a binary tree structure to store the relationship between MathTokens in a user inputted equations. An instance of this class contains a MathToken and a reference to a left and right sub equation.

Created by Michael Rule on Sun Aug 08 2004.


Constructor Summary
Equation()
          initializes an empty equation
Equation(Equation equ)
          Cloning Equation constructor
Equation(Equation equ, MathToken opr)
          combines an equation and a single MathToken
Equation(Equation equ, MathToken opr, Equation equ2)
          cobmines two equations with a perscribed operation
Equation(MathToken opr)
 
Method Summary
 boolean equals(Equation equ)
          A lazy equals method that compares the toStrings of both equations
 complex evaluate(ComplexVarList variables)
          Evaluates the equation for the given variables
 Evaluation getEvaluationOperation()
 Equation getLeft()
 Evaluation getOperation()
 Equation getRight()
 java.lang.String getVariables()
          returns a string of the chars of all variables contained within this Equation structure
 boolean is_analytic()
          Checks if an equation is analytic
 void setEvaluationOperation(MathToken token)
          Sets the MathToken of this Equation
 void setLeft(Equation equ)
          Sets the left subEquation of this Equation
 void setRight(Equation equ)
          Sets the right subEquation of this Equation
 void substitute(char Variable, complex number)
          Performs variable substitution ..
 java.lang.String toString()
          This overrides toString in Object and converts an Equation into a fairly readable String
 java.lang.String toStringHelper()
          assists toString, calling itself recursivly on all subEquatons
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Equation

public Equation()
initializes an empty equation


Equation

public Equation(Equation equ,
                MathToken opr,
                Equation equ2)
cobmines two equations with a perscribed operation

Parameters:
equ -
opr -
equ2 -

Equation

public Equation(Equation equ,
                MathToken opr)
combines an equation and a single MathToken

Parameters:
equ -
opr -

Equation

public Equation(MathToken opr)
Parameters:
opr -

Equation

public Equation(Equation equ)
Cloning Equation constructor

Parameters:
equ -
Method Detail

getOperation

public Evaluation getOperation()
Returns:

getLeft

public Equation getLeft()
Returns:

getRight

public Equation getRight()
Returns:

setEvaluationOperation

public void setEvaluationOperation(MathToken token)
Sets the MathToken of this Equation

Parameters:
token -

getEvaluationOperation

public Evaluation getEvaluationOperation()
Returns:

setLeft

public void setLeft(Equation equ)
Sets the left subEquation of this Equation

Parameters:
equ -

setRight

public void setRight(Equation equ)
Sets the right subEquation of this Equation

Parameters:
equ -

evaluate

public complex evaluate(ComplexVarList variables)
Evaluates the equation for the given variables

Parameters:
variables -
Returns:

substitute

public void substitute(char Variable,
                       complex number)
Performs variable substitution .. I think ? looks weird

Parameters:
Variable -
number -

is_analytic

public boolean is_analytic()
Checks if an equation is analytic

Returns:

getVariables

public java.lang.String getVariables()
returns a string of the chars of all variables contained within this Equation structure

Returns:

equals

public boolean equals(Equation equ)
A lazy equals method that compares the toStrings of both equations

Parameters:
equ -
Returns:

toString

public java.lang.String toString()
This overrides toString in Object and converts an Equation into a fairly readable String

Overrides:
toString in class java.lang.Object
Returns:

toStringHelper

public java.lang.String toStringHelper()
assists toString, calling itself recursivly on all subEquatons

Returns: