MathFunction Class
Base class for all functions rendered by MathCanvas.
Derived classes must implement toString() and evaluate(). To override the default rendering which displays the output from toString(), implement layout() and render().
Constructor
MathFunction
()
Item Index
Methods
evaluate
-
var_list
Must be implemented by derived classes.
Parameters:
-
var_list
Objectmap of variable names to values or MathFunctions
Returns:
the value of the function
handleKeyPress
-
canvas
-
code
-
c
Overridden by Input.
Parameters:
-
canvas
MathCanvas -
code
Intcharacter code
-
c
Stringcharacter
Returns:
true if function changed
layout
-
context
-
top_left
-
font_size
-
rect_list
Add the layout information for this object and its descendants to rect_list.
Parameters:
-
context
Objectthe drawing context
-
top_left
Pointx,y coordinates of the top left of the bounding box
-
font_size
Floatpercentage of the base font size
-
rect_list
RectListlayout information
Returns:
index of this items info in rect_list
parenthesizeForPrint
-
f
Parameters:
Returns:
true if f needs to parenthesize us
parenthesizeForRender
-
f
Parameters:
Returns:
true if f needs to parenthesize us
render
-
context
-
rect_list
Draw this object and its descendants.
Parameters:
-
context
Objectthe drawing context
-
rect_list
RectListlayout information
toString
()
Must be implemented by derived classes.
Returns:
text representation of the function