JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

Elements

Classes


Class JXG.JessieCode


      ↳ JXG.JessieCode



Defined in: jessiecode.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
JXG.JessieCode(code, geonext)
A JessieCode object provides an interface to the parser and stores all variables and objects used within a JessieCode script.
Field Summary
Field Attributes Field Name and Description
 
Store $log messages in case there's no console.
 
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.
<private>  
A stack to store debug information (like line and column where it was defined) of a parameter
 
lhs flag, used by JXG.JessieCode#replaceNames
<private>  
lhs
Store the left hand side of an assignment.
 
Keep track of which element is created in which line.
<private>  
The current scope of the object literal stack JXG.JessieCode#propstack.
<private>  
Used to store the property-value definition while parsing an object literal.
<private>  
Determines the parameter stack scope.
 
The global scope.
 
Keeps track of all possible scopes every required.
 
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
<private>  
_debug(log)
Output a debugging message.
<private>  
_error(msg)
Throws an exception with the given error message.
<private>  
_warn(msg)
Output a warning message using JXG#debug and precedes the message with "Warning: ".
 
add(a, b)
+ operator implementation
 
collectDependencies(node, result)
Search the parse tree below node for stationary dependencies, i.e.
<private>  
compile(node, js)
Compiles a parse tree back to JessieCode.
 
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.
 
Converts a node type node_op and value op_map or op_function into a executable function.
 
del(element)
Implementation of the delete() builtin function
 
dist(p1, p2)
This is used as the global dist() function.
 
div(a, b)
Implementation of the / operator.
<private>  
execute(node)
Executes a parse subtree.
 
findSymbol(v, scope)
Find the first symbol to the given value from the given scope upwards.
 
Looks up an JXG.GeometryElement by its id.
 
getLHS(node)
Resolves the lefthand side of an assignment operation
 
getvar(vname, local)
Looks up the value of the given variable.
 
getvarJS(vname, local, withProps)
TODO this needs to be called from JS and should not generate JS code Looks up a variable identifier in various tables and generates JavaScript code that could be eval'd to get the value.
 
ifthen(cond, v1, v2)
Implementation of the ?: operator
 
importModule(module)
Import modules into a JessieCode script.
 
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 the current scope chain.
 
isMathMethod(vname)
Checks if the given variable identifier is a valid member of the JavaScript Math Object.
 
isParameter(vname)
Checks if the given variable name is a parameter in any scope from the current to the global scope.
 
L(e)
This is used as the global L() function.
 
letvar(vname, value)
Assigns a value to a variable in the current scope.
 
Adds the property isMap to a function and sets it to true.
 
Merge all atribute values given with an element creator into one object.
 
mod(a, b)
Implementation of the % operator.
 
mul(a, b)
Multiplication of vectors and numbers
 
node(type, value, children)
Create a new parse tree node.
 
parse(code, geonext, dontstore)
Parses JessieCode
 
Remove the current scope and reinstate the previous scope
 
pow(a, b)
Pow function wrapper to allow direct usage of sliders.
 
pushScope(args)
Create a new scope.
 
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.
 
resolve(vname)
Look up the value of a local variable.
 
setProp(o, what, value)
Sets the property what of o to value
 
snippet(code, funwrap, varname, geonext)
Parses a JessieCode snippet, e.g.
 
sub(a, b)
+ operator implementation
 
use(board)
Implementation of the use() builtin function
 
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 interface 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
$log
Store $log messages in case there's no console.

{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.

<private> {Array} dpstack
A stack to store debug information (like line and column where it was defined) of a parameter

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

<private> {Array} lhs
Store the left hand side of an assignment. If an element is constructed and no attributes are given, this is used as the element's name.

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

<private> {Number} propscope
The current scope of the object literal stack JXG.JessieCode#propstack.

<private> {Array} propstack
Used to store the property-value definition while parsing an object literal.

<private> {Number} pscope
Determines the parameter stack scope.

scope
The global scope.

scopes
Keeps track of all possible scopes every required.

{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
<private> _debug(log)
Output a debugging message. Uses debug console, if available. Otherwise an HTML element with the id "debug" and an innerHTML property is used.
Parameters:
{String} log

<private> _error(msg)
Throws an exception with the given error message.
Parameters:
{String} msg
Error message

<private> _warn(msg)
Output a warning message using JXG#debug and precedes the message with "Warning: ".
Parameters:
{String} msg

{Number|Array} add(a, b)
+ operator implementation
Parameters:
{Number|Array|JXG.Point} a
{Number|Array|JXG.Point} b
Returns:
{Number|Array}

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.

<private> compile(node, js)
Compiles a parse tree back to JessieCode.
Parameters:
{Object} node
{Boolean} js Optional, Default: false
Currently ignored. Compile either to JavaScript or back to JessieCode (required for the UI).
Returns:
Something

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

{function} defineFunction(node)
Converts a node type node_op and value op_map or op_function into a executable function.
Parameters:
{Object} node
Returns:
{function}

del(element)
Implementation of the delete() builtin function
Parameters:
{JXG.GeometryElement} element

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

{Number|Array} div(a, b)
Implementation of the / operator.
Parameters:
{Number|Array} a
{Number} b
Returns:
{Number|Array}

<private> {Number|String|Object|Boolean} execute(node)
Executes a parse subtree.
Parameters:
{Object} node
Returns:
{Number|String|Object|Boolean} Something

{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}

{Object} getLHS(node)
Resolves the lefthand side of an assignment operation
Parameters:
node
Returns:
{Object} An object with two properties. o which contains the object, and a string what which contains the property name.

getvar(vname, local)
Looks up the value of the given variable.
Parameters:
{String} vname
Name of the variable
{Boolean} local Optional, Default: false
Only look up the internal symbol table and don't look for the vname in Math or the element list.

getvarJS(vname, local, withProps)
TODO this needs to be called from JS and should not generate JS code 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
{Boolean} withProps Optional, Default: false

{*} ifthen(cond, v1, v2)
Implementation of the ?: operator
Parameters:
{Boolean} cond
Condition
{*} v1
{*} v2
Returns:
{*} Either v1 or v2.

importModule(module)
Import modules into a JessieCode script.
Parameters:
{String} module

{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}

{Object} isLocalVariable(vname)
Checks if the given variable name can be found in the current scope chain.
Parameters:
{String} vname
Returns:
{Object} A reference to the scope object the variable can be found in or null if it can'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}

{Object} isParameter(vname)
Checks if the given variable name is a parameter in any scope from the current to the global scope.
Parameters:
{String} vname
Returns:
{Object} A reference to the scope object that contains the variable in its arg list.

{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

{function} makeMap(f)
Adds the property isMap to a function and sets it to true.
Parameters:
{function} f
Returns:
{function}

{Object} mergeAttributes(o)
Merge all atribute values given with an element creator into one object.
Parameters:
{Object} o
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} mod(a, b)
Implementation of the % operator.
Parameters:
{Number|Array} a
{Number} b
Returns:
{Number|Array}

{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.
{Boolean} dontstore

{Object} popScope()
Remove the current scope and reinstate the previous scope
Returns:
{Object}

{Number} pow(a, b)
Pow function wrapper to allow direct usage of sliders.
Parameters:
{Number|Slider} a
{Number|Slider} b
Returns:
{Number}

{Object} pushScope(args)
Create a new scope.
Parameters:
{Array} args
Returns:
{Object}

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

{*} resolve(vname)
Look up the value of a local variable.
Parameters:
{string} vname
Returns:
{*}

setProp(o, what, value)
Sets the property what of o to value
Parameters:
{JXG.Point|JXG.Text} o
{String} what
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.

{Number|Array} sub(a, b)
+ operator implementation
Parameters:
{Number|Array|JXG.Point} a
{Number|Array|JXG.Point} b
Returns:
{Number|Array}

use(board)
Implementation of the use() builtin function
Parameters:
{String} board

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

{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 Tue Jul 05 2016 11:01:13 GMT+0200 (CEST)