Class Index | File Index

Classes


Class JXG.JessieCode


Defined in: JessieCode.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
JXG.JessieCode(code, geonext)
A JessieCode object provides an interfacce to the parser and stores all variables and objects used within a JessieCode script.
Field Summary
Field Attributes Field Name and Description
 
The board which currently is used to create and look up elements.
 
Built-in functions and constants
 
Returns a element creator function which takes two parameters: the parents array and the attributes object.
 
lhs flag, used by JXG.JessieCode#replaceNames
 
Keep track of which element is created in which line.
 
The id of an HTML node in which innerHTML all warnings are stored (if no console object is available).
Method Summary
Method Attributes Method Name and Description
 
collectDependencies(node, result)
Search the parse tree below node for stationary dependencies, i.e.
 
createNode(type, value, children)
Create a new parse tree node.
 
Replaces node_var nodes with node_op>op_execfun nodes, calling the internal $() function with the id of the element accessed by the node_var node.
 
Defines built in methods and constants.
 
dist(p1, p2)
This is used as the global dist() function.
 
findSymbol(v, scope)
Find the first symbol to the given value from the given scope upwards.
 
Looks up an JXG.GeometryElement by its id.
 
getvar(vname, local)
Looks up the value of the given variable.
 
getvarJS(vname, local, withProps)
Looks up a variable identifier in various tables and generates JavaScript code that could be eval'd to get the value.
 
isBuiltIn(vname)
Returns true if the given identifier is a builtIn variable/function.
 
isCreator(vname)
Checks if the given variable name is a valid creator method.
 
Checks if the given variable name can be found in JXG.JessieCode#sstack.
 
isMathMethod(vname)
Checks if the given variable identifier is a valid member of the JavaScript Math Object.
 
L(e)
This is used as the global L() function.
 
letvar(vname, value)
Assigns a value to a variable in the current scope.
 
Merge all atribute values given with an element creator into one object.
 
mul(a, b)
Multiplication of vectors and numbers
 
node(type, value, children)
Create a new parse tree node.
 
parse(code, geonext, dontstore)
Parses JessieCode
 
replaceIDs(node)
Traverses through the given subtree and changes all values of nodes with the replaced flag set by JXG.JessieCode#replaceNames to the name of the element (if not empty).
 
Traverses through the given subtree and changes all elements referenced by names through referencing them by ID.
 
setProp(what, value, value)
Sets the property what of JXG.JessieCode#propobj to value
 
snippet(code, funwrap, varname, geonext)
Parses a JessieCode snippet, e.g.
 
utf8_encode(string)
Encode characters outside the ASCII table into HTML Entities, because JavaScript or JS/CC can't handle a RegEx applied to a string with unicode characters.
 
V(e)
This is used as the global V() function.
 
X(e)
This is used as the global X() function.
 
Y(e)
This is used as the global Y() function.
Class Detail
JXG.JessieCode(code, geonext)
A JessieCode object provides an interfacce to the parser and stores all variables and objects used within a JessieCode script. The optional argument code is interpreted after initializing. To evaluate more code after initializing a JessieCode instance please use JXG.JessieCode#parse. For code snippets like single expressions use JXG.JessieCode#snippet.
Parameters:
{String} code Optional
Code to parse.
{Boolean} geonext Optional, Default: false
Geonext compatibility mode.
Field Detail
{JXG.Board} board
The board which currently is used to create and look up elements.

{Object} builtIn
Built-in functions and constants

{function} creator
Returns a element creator function which takes two parameters: the parents array and the attributes object.

{Boolean} isLHS
lhs flag, used by JXG.JessieCode#replaceNames
Default Value:
false

{Object} lineToElement
Keep track of which element is created in which line.

{String} warnLog
The id of an HTML node in which innerHTML all warnings are stored (if no console object is available).
Default Value:
'jcwarn'
Method Detail
collectDependencies(node, result)
Search the parse tree below node for stationary dependencies, i.e. dependencies hard coded into the function.
Parameters:
{Object} node
{Object} result
An object where the referenced elements will be stored. Access key is their id.

createNode(type, value, children)
Create a new parse tree node. Basically the same as node(), but this builds the children part out of an arbitrary number of parameters, instead of one array parameter.
Parameters:
{String} type
Type of node, e.g. node_op, node_var, or node_const
value
The nodes value, e.g. a variables value or a functions body.
children
Arbitrary number of parameters; define the child nodes.

{Object} createReplacementNode(node)
Replaces node_var nodes with node_op>op_execfun nodes, calling the internal $() function with the id of the element accessed by the node_var node.
Parameters:
{Object} node
Returns:
{Object} op_execfun node

{Object} defineBuiltIn()
Defines built in methods and constants.
Returns:
{Object} BuiltIn control object

{Number} dist(p1, p2)
This is used as the global dist() function.
Parameters:
{JXG.Point} p1
{JXG.Point} p2
Returns:
{Number}

{Array} findSymbol(v, scope)
Find the first symbol to the given value from the given scope upwards.
Parameters:
{%} v
Value
{Number} scope Optional, Default: -1
The scope, default is to start with current scope (-1).
Returns:
{Array} An array containing the symbol and the scope if a symbol could be found, an empty array otherwise;

{JXG.GeometryElement} getElementById(id)
Looks up an JXG.GeometryElement by its id.
Parameters:
{String} id
Returns:
{JXG.GeometryElement}

getvar(vname, local)
Looks up the value of the given variable.
Parameters:
{String} vname
Name of the variable
local

getvarJS(vname, local, withProps)
Looks up a variable identifier in various tables and generates JavaScript code that could be eval'd to get the value.
Parameters:
{String} vname
Identifier
{Boolean} local Optional, Default: false
Don't resolve ids and names of elements
withProps

{Boolean} isBuiltIn(vname)
Returns true if the given identifier is a builtIn variable/function.
Parameters:
{String} vname
Returns:
{Boolean}

{Boolean} isCreator(vname)
Checks if the given variable name is a valid creator method.
Parameters:
{String} vname
Returns:
{Boolean}

{Number} isLocalVariable(vname)
Checks if the given variable name can be found in JXG.JessieCode#sstack.
Parameters:
{String} vname
Returns:
{Number} The position in the local variable stack where the variable can be found. -1 if it couldn't be found.

{Boolean} isMathMethod(vname)
Checks if the given variable identifier is a valid member of the JavaScript Math Object.
Parameters:
{String} vname
Returns:
{Boolean}

{Number} L(e)
This is used as the global L() function.
Parameters:
{JXG.Line} e
Returns:
{Number}

letvar(vname, value)
Assigns a value to a variable in the current scope.
Parameters:
{String} vname
Variable name
{%} value
Anything
See:
JXG.JessieCode#sstack
JXG.JessieCode#scope

{Object} mergeAttributes()
Merge all atribute values given with an element creator into one object.
Parameters:
{Object} ...
An arbitrary number of objects
Returns:
{Object} All given objects merged into one. If properties appear in more (case sensitive) than one object the last value is taken.

{Number|Array} mul(a, b)
Multiplication of vectors and numbers
Parameters:
{Number|Array} a
{Number|Array} b
Returns:
{Number|Array} (Inner) product of the given input values.

node(type, value, children)
Create a new parse tree node.
Parameters:
{String} type
Type of node, e.g. node_op, node_var, or node_const
value
The nodes value, e.g. a variables value or a functions body.
{Array} children
Arbitrary number of child nodes.

parse(code, geonext, dontstore)
Parses JessieCode
Parameters:
{String} code
{Boolean} geonext Optional, Default: false
Geonext compatibility mode.
dontstore

replaceIDs(node)
Traverses through the given subtree and changes all values of nodes with the replaced flag set by JXG.JessieCode#replaceNames to the name of the element (if not empty).
Parameters:
{Object} node

replaceNames(node)
Traverses through the given subtree and changes all elements referenced by names through referencing them by ID. An identifier is only replaced if it is not found in all scopes above the current scope and if it has not been blacklisted within the codeblock determined by the given subtree.
Parameters:
{Object} node

setProp(what, value, value)
Sets the property what of JXG.JessieCode#propobj to value
Parameters:
{String} what
{%} value
value

snippet(code, funwrap, varname, geonext)
Parses a JessieCode snippet, e.g. "3+4", and wraps it into a function, if desired.
Parameters:
{String} code
A small snippet of JessieCode. Must not be an assignment.
{Boolean} funwrap
If true, the code is wrapped in a function.
{String} varname
Name of the parameter(s)
{Boolean} geonext Optional, Default: false
Geonext compatibility mode.

{String} utf8_encode(string)
Encode characters outside the ASCII table into HTML Entities, because JavaScript or JS/CC can't handle a RegEx applied to a string with unicode characters.
Parameters:
{String} string
Returns:
{String}

{%} V(e)
This is used as the global V() function.
Parameters:
{Glider|Slider} e
Returns:
{%}

{Number} X(e)
This is used as the global X() function.
Parameters:
{JXG.Point|JXG.Text} e
Returns:
{Number}

{Number} Y(e)
This is used as the global Y() function.
Parameters:
{JXG.Point|JXG.Text} e
Returns:
{Number}

Documentation generated by JsDoc Toolkit 2.4.0 on Fri May 31 2013 05:21:37 GMT-0000 (UTC)