staborde
Class SOModel

java.lang.Object
  extended by staborde.SOModel

public class SOModel
extends java.lang.Object

Model that provides a rational function R(z) of which the region of stability and order star are to be determined. This model can use either a predefined SOFunction or a custom user-provided function (which is then parsed by a JEP).


Constructor Summary
SOModel()
          Create a new model.
 
Method Summary
 double absDenom(double re, double im, double p)
           
 double absE(double re, double im)
           
 double absNum(double re, double im, double p)
           
 void addChangeListener(javax.swing.event.ChangeListener l)
          Add a ChangeListener.
 void fireStateChanged(javax.swing.event.ChangeEvent e)
          Notify all ChangeListeners.
 java.lang.String getDenominator()
           
 java.lang.String getDescription()
           
 java.lang.String getError()
           
 SOFunction getFunction()
           
 java.lang.String getNumerator()
           
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Remove a ChangeListener.
 boolean setCustomFunction(java.lang.String num, java.lang.String denom, java.lang.String desc)
          Set the custom function to use.
 void setFunction(SOFunction f)
          Set the predefined function to use.
 boolean usesCustomFunction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SOModel

public SOModel()
Create a new model. By default, this model uses the first of the available predefined functions.

Method Detail

getDescription

public java.lang.String getDescription()
Returns:
a complete description of the function in use.

getNumerator

public java.lang.String getNumerator()
Returns:
the numerator of the function in use.

getDenominator

public java.lang.String getDenominator()
Returns:
the denominator of the function in use.

getError

public java.lang.String getError()
Returns:
the error (if any) while parsing the last expression.

getFunction

public SOFunction getFunction()
Returns:
the predefined function in use, null if a custom function is being used.

setFunction

public void setFunction(SOFunction f)
Set the predefined function to use.


setCustomFunction

public boolean setCustomFunction(java.lang.String num,
                                 java.lang.String denom,
                                 java.lang.String desc)
Set the custom function to use.

Parameters:
num - the numerator for the custom function.
denom - the denominator for the custom function.
desc - a description of the given function (a default is used if this value is null).
Returns:
whether the given values were accepted. If this methods returns false, use getError() to find out what error(s) occurred.

usesCustomFunction

public boolean usesCustomFunction()
Returns:
whether a custom function is in use.

absNum

public double absNum(double re,
                     double im,
                     double p)
Returns:
the absolute value of the numerator, for z = (re, im) and given p.

absDenom

public double absDenom(double re,
                       double im,
                       double p)
Returns:
the absolute value of the denominator, for z = (re, im) and given p.

absE

public double absE(double re,
                   double im)
Returns:
exp(z).

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Add a ChangeListener.


removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Remove a ChangeListener.


fireStateChanged

public void fireStateChanged(javax.swing.event.ChangeEvent e)
Notify all ChangeListeners.