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_listObjectmap of variable names to values or MathFunctions
Returns:
the value of the function
handleKeyPress
-
canvas -
code -
c
Overridden by Input.
Parameters:
-
canvasMathCanvas -
codeIntcharacter code
-
cStringcharacter
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:
-
contextObjectthe drawing context
-
top_leftPointx,y coordinates of the top left of the bounding box
-
font_sizeFloatpercentage of the base font size
-
rect_listRectListlayout 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:
-
contextObjectthe drawing context
-
rect_listRectListlayout information
toString
()
Must be implemented by derived classes.
Returns:
text representation of the function
