data
Class StandardNormalTable

java.lang.Object
  extended by edu.hws.jcm.functions.FunctionParserExtension
      extended by edu.hws.jcm.functions.TableFunction
          extended by data.StandardNormalTable
All Implemented Interfaces:
ExpressionCommand, Function, MathObject, ParserExtension, java.io.Serializable

public class StandardNormalTable
extends TableFunction

StandardNormalTable

This class manage a reduced centered normal law table. The table values must be stocked in a file in the following format :
To use the function, it must be registered with a parser, or even better, call the constructor with a specified parser.

Copyright(c) 2005 Université Laval, LSFM research group.

Version:
1.0
Author:
Nicolas Richard
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.hws.jcm.functions.TableFunction
PIECEWISE_LINEAR, SMOOTH, STEP, STEP_LEFT, STEP_RIGHT
 
Fields inherited from class edu.hws.jcm.functions.FunctionParserExtension
name
 
Constructor Summary
StandardNormalTable()
          Default constructor without parameters.
StandardNormalTable(java.lang.String file)
          Constructor with a specified file.
StandardNormalTable(java.lang.String file, Parser p, Variable y)
          Constructir with a file and parser specified.
 
Method Summary
 void apply(StackOfDouble stack, Cases cases)
          Returns the evaluation of the function using the real number on the top of the stack as a parameter.
 double getVal(double v)
          Get the value of the function with the specified v value.
 double getVal(double[] args)
          This function can compute no more than one value of v.
 double getValueWithCases(double[] params, Cases cases)
          This function is simply a wrapper.
 java.lang.String toString()
          Returns a string representing the normal law.
 
Methods inherited from class edu.hws.jcm.functions.TableFunction
addIntervals, addPoint, addPoints, copyDataFrom, dependsOn, derivative, derivative, findPoint, getArity, getPointCount, getStyle, getX, getY, removeAllPoints, removePointAt, setStyle, setY
 
Methods inherited from class edu.hws.jcm.functions.FunctionParserExtension
appendOutputString, compileDerivative, doParse, extent, getName, setName, setParensCanBeOptional
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardNormalTable

public StandardNormalTable()
Default constructor without parameters. Will load the file called "StandardNormalTable.txt".


StandardNormalTable

public StandardNormalTable(java.lang.String file)
Constructor with a specified file. Will load the standard normal table from an alternate file. * The table values must be stocked in a file in the following format :

Parameters:
file - the file from which to load the table.

StandardNormalTable

public StandardNormalTable(java.lang.String file,
                           Parser p,
                           Variable y)
Constructir with a file and parser specified. The table will be loadeed from the file, then registered with the parser. This is the fastest way of using a normal table.

Parameters:
file - the file name from which to load the table
p - the parser with which the table will be registered
y - the variable to be evaluated
See Also:
StandardNormalTable#StandardNormalTable(File)
Method Detail

getVal

public double getVal(double v)
Get the value of the function with the specified v value.

Overrides:
getVal in class TableFunction
Parameters:
v - value of the variable in the function.
Returns:
value computated using v as the variable's value.

getVal

public double getVal(double[] args)
This function can compute no more than one value of v. We simply pass the first element to getVal(double)

Specified by:
getVal in interface Function
Overrides:
getVal in class TableFunction
Parameters:
args - a list of real numbers to evaluate
Returns:
the evaluation of the fuction using the first element of the list
See Also:
getVal(double)

getValueWithCases

public double getValueWithCases(double[] params,
                                Cases cases)
This function is simply a wrapper. It calls the getVal function with the list of real numbers, dropping along the cases.

Specified by:
getValueWithCases in interface Function
Overrides:
getValueWithCases in class TableFunction
Parameters:
params - a list of real numbers to evaluate
cases - ignored
Returns:
the evaluation of the first number contained in the list

apply

public void apply(StackOfDouble stack,
                  Cases cases)
Returns the evaluation of the function using the real number on the top of the stack as a parameter.

Specified by:
apply in interface ExpressionCommand
Overrides:
apply in class TableFunction
Parameters:
stack - a stack containg doubles
cases - ignored

toString

public java.lang.String toString()
Returns a string representing the normal law. The string returned is in the form of NAME((Y - mu) / sigma), where NAME is usually "Normal" and where Y is the variable specified in the constructor or simply "y" if unspecified.

Overrides:
toString in class java.lang.Object
Returns:
a string representing the normal function.