vmm.core
Class UserExhibit.FunctionInfo

java.lang.Object
  extended by vmm.core.UserExhibit.FunctionInfo
Enclosing interface:
UserExhibit

public static class UserExhibit.FunctionInfo
extends java.lang.Object

An object of type FunctionInfo holds information about one the functions, to be entered by the user, that compute the data for the user exhibit. An object of type FunctionInfo is created by the methods UserExhibit.Support.addRealFunction(String, String, String[]) and UserExhibit.Support.addComplexFunction(String, String, String[]); it is not possible to create an object of this type directly. A FunctionInfo object contains either a real-valued function, of type Function, or a complex-valued function, of type ComplexFunction, depending on which method created it.


Method Summary
 Complex complexFunctionValue(Complex... arg)
          Returns the value of the complex-valued function contained in this FunctionInfo object, at a specified list of input arguments for the functions.
 Complex complexFunctionValue(double... arg)
          Returns the value of the complex-valued function contained in this FunctionInfo object, at a specified list of input arguments for the functions.
 java.lang.String[] getArgumentNames()
          Returns the names of the arguments to the function, as specified in the parameter list of UserExhibit.Support.addRealFunction(String, String, String[]) or UserExhibit.Support.addComplexFunction(String, String, String[]) when this FunctionInfo object was created.
 ComplexFunction getComplexFunction()
          Returns the complex-valued function contained in this FunctionInfo object, or returns null if no function has been created yet.
 java.lang.String getDefinition()
          Returns the names of the arguments to the function, as entered by the user.
 boolean getIsComplex()
          Tells whether the function is complex-valued or real-valued.
 java.lang.String getName()
          Returns the name of the function, as specified in the parameter list of UserExhibit.Support.addRealFunction(String, String, String[]) or UserExhibit.Support.addComplexFunction(String, String, String[]) when this FunctionInfo object was created.
 Function getRealFunction()
          Returns the real-valued function contained in this FunctionInfo object, or returns null if no function has been created yet.
 double realFunctionValue(double... arg)
          Returns the value of the real-valued function contained in this FunctionInfo object, at a specified list of input arguments for the functions.
 void setPrompt(java.lang.String prompt)
          Set the label to be used next to the text fiels in the dialog box where the user enters the definition of the fuction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

realFunctionValue

public double realFunctionValue(double... arg)
Returns the value of the real-valued function contained in this FunctionInfo object, at a specified list of input arguments for the functions. This method should only be called for a FucntionInfo that was created by the method UserExhibit.Support.addRealFunction(String, String, String[]).

Throws:
java.lang.ClassCastException - if the function is complex-valued, not real-valued
java.lang.IllegalArgumentException - if the number of arguments does not match the arity of the function

complexFunctionValue

public Complex complexFunctionValue(Complex... arg)
Returns the value of the complex-valued function contained in this FunctionInfo object, at a specified list of input arguments for the functions. This method should only be called for a FucntionInfo that was created by the method UserExhibit.Support.addComplexFunction(String, String, String[]).

Throws:
java.lang.ClassCastException - if the function is real-valued, not complex-valued
java.lang.IllegalArgumentException - if the number of arguments does not match the arity of the function

complexFunctionValue

public Complex complexFunctionValue(double... arg)
Returns the value of the complex-valued function contained in this FunctionInfo object, at a specified list of input arguments for the functions. The arguments are specified by values of type double that give the real and imaginary parts of the complex arguments that are to be passed to the function. This method should only be called for a FucntionInfo that was created by the method UserExhibit.Support.addComplexFunction(String, String, String[]). That is, complexFunctionValue(re1,im1,re2,im2...) is equivalent to complexFunction(new Complex(re1,im1), new Complex(re2,im2)...)
Throws:
java.lang.ClassCastException - if the function is real-valued, not complex-valued
java.lang.IllegalArgumentException - if the number of arguments is not equal to the arity of the function multiplied by two.

getRealFunction

public Function getRealFunction()
Returns the real-valued function contained in this FunctionInfo object, or returns null if no function has been created yet. Warning: Just after a FunctionInfo object has been created, the return value is null; it will only be non-null after the user has had a chance to enter the definition of the function. Furthermove, the function can change later, if UserExhibit.Support.showChangeDialog(Display, View) is called.} This means that you should ordinarily not keep a copy of the value returned by this method, and that there is generally little reason to use it. Note that if the arity of the fucntion is 1, 2, or 3, then the return value will actuall be of type Function1, Function2, or Function3.

Throws:
java.lang.ClassCastException - if the function is complex-valued, not real-valued.

getComplexFunction

public ComplexFunction getComplexFunction()
Returns the complex-valued function contained in this FunctionInfo object, or returns null if no function has been created yet. Warning: Just after a FunctionInfo object has been created, the return value is null; it will only be non-null after the user has had a chance to enter the definition of the function. Furthermove, the function can change later, if UserExhibit.Support.showChangeDialog(Display, View) is called.} This means that you should ordinarily not keep a copy of the value returned by this method, and that there is generally little reason to use it. Note that if the arity of the fucntion is 1, 2, or 3, then the return value will actuall be of type ComplexFunction1, ComplexFunction2, or ComplexFunction3.

Throws:
java.lang.ClassCastException - if the function is real-valued, not complex-valued.

getArgumentNames

public java.lang.String[] getArgumentNames()
Returns the names of the arguments to the function, as specified in the parameter list of UserExhibit.Support.addRealFunction(String, String, String[]) or UserExhibit.Support.addComplexFunction(String, String, String[]) when this FunctionInfo object was created.


getDefinition

public java.lang.String getDefinition()
Returns the names of the arguments to the function, as entered by the user.


getIsComplex

public boolean getIsComplex()
Tells whether the function is complex-valued or real-valued.


getName

public java.lang.String getName()
Returns the name of the function, as specified in the parameter list of UserExhibit.Support.addRealFunction(String, String, String[]) or UserExhibit.Support.addComplexFunction(String, String, String[]) when this FunctionInfo object was created.


setPrompt

public void setPrompt(java.lang.String prompt)
Set the label to be used next to the text fiels in the dialog box where the user enters the definition of the fuction. By default, the prompt is of a form such as "f(x,y)" where "f" is the name of the function and "x" and "y" are the arguments of the function. You only need to use this method if you would like a different prompt.