|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.webcompmath.functions.FunctionParserExtension net.sourceforge.webcompmath.functions.ExpressionFunction net.sourceforge.webcompmath.functions.beans.WCMExpressionFunctionBean
public class WCMExpressionFunctionBean
This bean extends ExpressionFunction. You need to set its definition before it will do anything. By default, it uses a default parser with one variable, "x". If you want to use more variables in the definition, set the parser to one that has those additional variables set for it. You can use this bean as either an expression, where it is just evaluated at the current values of any parameters in it, or as a function (and hence you can graph it by adding it to a WCMGraph1DBean). If you add this bean to a parser, you can then use it like a function (change the default name if you would like something other than "ef1").
Field Summary |
---|
Fields inherited from class net.sourceforge.webcompmath.functions.ExpressionFunction |
---|
definition, params |
Fields inherited from class net.sourceforge.webcompmath.functions.FunctionParserExtension |
---|
name |
Constructor Summary | |
---|---|
WCMExpressionFunctionBean()
Default constructor; creates a WCMExpressionFunctionBean with default name efX (where X is some integer) and a definition of "0". |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Just pass through to the support class |
void |
apply(StackOfDouble stack,
Cases cases)
Overridden to check if a redefine is needed. |
boolean |
dependsOn(Variable x)
Overridden to check if a redefine is needed. |
Function |
derivative(int wrt)
Overridden to check if a redefine is needed. |
Function |
derivative(Variable x)
Overridden to check if a redefine is needed. |
java.lang.String |
getDefinitionString()
Overridden to check if a redefine is needed. |
MathObject |
getMathObject()
Since this is a ParserExtension, just returns itself. |
int |
getNumVariables()
Just pass this method on to the super class. |
WCMParserBean |
getParser()
Get the parser |
double |
getVal()
get the value (for use when this represents an expression, not a function |
double |
getValueWithCases(double[] arguments,
Cases cases)
Overridden to check if a redefine is needed. |
Variable |
getVariable()
Get the first variable to be used when this class is treaded as a function of one or two variables. |
Variable |
getVariable2()
Get the 2nd variable to be used when this class is treaded as a function of two variables. |
void |
redefine()
Overloads the version of redefine so that the WCMExpressionFunctionBean's parser is always used. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
just pass through to the support class ) |
void |
setDefinition(java.lang.String def)
Set the definition of the expression |
void |
setName(java.lang.String name)
Fire a property change event if the name changes. |
void |
setNumVariables(int a)
Set the arity, which can be either 1 or 2. |
void |
setParser(WCMParserBean p)
Set the parser |
void |
setVariable(WCMVariableBean v)
Set the first variable to be used when this class is treated as a function of one or two variables. |
void |
setVariable2(WCMVariableBean v)
Set the 2nd variable to be used when this class is treated as a function of two variables. |
java.lang.String |
toString()
get a text representation of this function. |
Methods inherited from class net.sourceforge.webcompmath.functions.ExpressionFunction |
---|
getArity, getVal, redefine, redefine |
Methods inherited from class net.sourceforge.webcompmath.functions.FunctionParserExtension |
---|
appendOutputString, compileDerivative, doParse, extent, getName, setParensCanBeOptional |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sourceforge.webcompmath.data.MathObject |
---|
getName |
Constructor Detail |
---|
public WCMExpressionFunctionBean()
Method Detail |
---|
public void setVariable(WCMVariableBean v)
v
- public Variable getVariable()
public void setVariable2(WCMVariableBean v)
v
- public Variable getVariable2()
public int getNumVariables()
public void setNumVariables(int a)
a
- either 1 or 2public void setParser(WCMParserBean p)
p
- the parser to usepublic WCMParserBean getParser()
public void setDefinition(java.lang.String def)
def
- the new definitionpublic double getVal()
getVal
in interface Value
Value.getVal()
public MathObject getMathObject()
getMathObject
in interface ParserMathObject
ParserMathObject.getMathObject()
public java.lang.String toString()
toString
in class ExpressionFunction
ExpressionFunction.toString()
public void redefine()
ExpressionFunction.redefine(java.lang.String,
net.sourceforge.webcompmath.data.Parser)
public void apply(StackOfDouble stack, Cases cases)
apply
in interface ExpressionCommand
apply
in class ExpressionFunction
stack
- stack to usecases
- cases to useExpressionFunction.apply(net.sourceforge.webcompmath.data.StackOfDouble,
net.sourceforge.webcompmath.data.Cases)
public boolean dependsOn(Variable x)
dependsOn
in interface ExpressionCommand
dependsOn
in interface Function
dependsOn
in class ExpressionFunction
x
- variable to check
ExpressionFunction.dependsOn(net.sourceforge.webcompmath.data.Variable)
public Function derivative(int wrt)
derivative
in interface Function
derivative
in class ExpressionFunction
wrt
- index of the arg. with respect to
ExpressionFunction.derivative(int)
public Function derivative(Variable x)
derivative
in interface Function
derivative
in class ExpressionFunction
x
- variable with respect to
ExpressionFunction.derivative(net.sourceforge.webcompmath.data.Variable)
public java.lang.String getDefinitionString()
getDefinitionString
in class ExpressionFunction
ExpressionFunction.getDefinitionString()
public double getValueWithCases(double[] arguments, Cases cases)
getValueWithCases
in interface Function
getValueWithCases
in class ExpressionFunction
arguments
- array of args. to use in evaluationcases
- cases to use
ExpressionFunction.getValueWithCases(double[],
net.sourceforge.webcompmath.data.Cases)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface ParserMathObject
ParserMathObject.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface ParserMathObject
ParserMathObject.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void setName(java.lang.String name)
setName
in interface MathObject
setName
in class FunctionParserExtension
name
- name of the objectFunctionParserExtension.setName(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |