|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.moioli.drawables.AbstractPlaneCurve
net.moioli.drawables.ParsedPlaneCurve
public class ParsedPlaneCurve
This class provides a quick way to implement mathematical curves: parsing
them from strings. Just pass a string like "x^2+sin(x)" and "3y" to the
constructor and you'll get a drawable curve to add to your DefaultChart.
The parsing is done with the JEP parser, so strings should follow JEP's
syntax.
JEP
Constructor Summary | |
---|---|
ParsedPlaneCurve(java.lang.String xFunction,
java.lang.String yFunction,
double maxT)
Constructs a new function with the given strings (any point in this function has coordinates (x(t),y(t)). |
Method Summary | |
---|---|
java.lang.String |
toString()
Returns a string describing this function. |
double |
x(double t)
Returns the x value corresponding to the specified t (any point in this function has coordinates (x(t),y(t)). |
double |
y(double t)
Returns the y value corresponding to the specified t (any point in this function has coordinates (x(t),y(t)). |
Methods inherited from class net.moioli.drawables.AbstractPlaneCurve |
---|
drawMe, getMaxT, getXMaximum, getXMinimum, getYMaximum, getYMinimum, maxX, maxY, minX, minY, setMaxT |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ParsedPlaneCurve(java.lang.String xFunction, java.lang.String yFunction, double maxT) throws org.nfunk.jep.ParseException
xFunction
- the string to be parsed corresponting to x(t)yFunction
- the string to be parsed corresponting to y(t)maxT
- the maximum parameter value
org.nfunk.jep.ParseException
- if the string cannot be parsed by JEPJEP
Method Detail |
---|
public double x(double t)
PlaneCurveI
x
in interface PlaneCurveI
x
in class AbstractPlaneCurve
t
- the parameter's value
PlaneCurveI.x(double)
public double y(double t)
PlaneCurveI
y
in interface PlaneCurveI
y
in class AbstractPlaneCurve
t
- the parameter's value
PlaneCurveI.y(double)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |