libSBML C API
libSBML 5.8.0 C API
|
Abstract Syntax Tree (AST) for representing formula trees.
Macros | |
#define | ASTNodeType_isAvogadro(t) (t == AST_NAME_AVOGADRO) |
ASTNodeType predicates. More... | |
#define | ASTNodeType_isConstant(t) (((t >= AST_CONSTANT_E) && (t <= AST_CONSTANT_TRUE)) || t == AST_NAME_AVOGADRO) |
#define | ASTNodeType_isFunction(t) ((t >= AST_FUNCTION) && (t <= AST_FUNCTION_TANH)) |
#define | ASTNodeType_isInteger(t) (t == AST_INTEGER) |
#define | ASTNodeType_isLambda(t) (t == AST_LAMBDA) |
#define | ASTNodeType_isLogical(t) ((t >= AST_LOGICAL_AND) && (t <= AST_LOGICAL_XOR)) |
#define | ASTNodeType_isName(t) ((t >= AST_NAME) && (t <= AST_NAME_TIME)) |
#define | ASTNodeType_isNumber(t) (ASTNodeType_isInteger(t) || ASTNodeType_isReal(t)) |
#define | ASTNodeType_isOperator(t) |
#define | ASTNodeType_isRational(t) (t == AST_RATIONAL) |
#define | ASTNodeType_isReal(t) ((t >= AST_REAL) && (t <= AST_RATIONAL)) |
#define | ASTNodeType_isRelational(t) ((t >= AST_RELATIONAL_EQ) && (t <= AST_RELATIONAL_NEQ)) |
#define | ASTNodeType_isUnknown(t) (t == AST_UNKNOWN) |
Functions | |
int | ASTNode_addChild (ASTNode_t *node, ASTNode_t *child) |
Adds the given node as a child of this ASTNode. More... | |
int | ASTNode_addSemanticsAnnotation (ASTNode_t *node, XMLNode_t *annotation) |
Adds the given XMLNode as a semantic annotation of this ASTNode. More... | |
int | ASTNode_canonicalize (ASTNode_t *node) |
Attempts to convert this ASTNode to a canonical form and returns true (non-zero) if the conversion succeeded, false (0) otherwise. More... | |
ASTNode_t * | ASTNode_create (void) |
Creates a new ASTNode and returns a pointer to it. More... | |
ASTNode_t * | ASTNode_createFromToken (Token_t *token) |
Creates a new ASTNode from the given Token and returns a pointer to it. More... | |
ASTNode_t * | ASTNode_createWithType (ASTNodeType_t type) |
Creates a new ASTNode and sets its type to the given ASTNodeType. More... | |
ASTNode_t * | ASTNode_deepCopy (const ASTNode_t *node) |
void | ASTNode_fillListOfNodes (const ASTNode_t *node, ASTNodePredicate predicate, List_t *lst) |
This method is identical in functionality to ASTNode_getListOfNodes(), except the List is passed-in by the caller. More... | |
void | ASTNode_free (ASTNode_t *node) |
Frees the given ASTNode including any child nodes. More... | |
int | ASTNode_freeName (ASTNode_t *node) |
Frees the name of this ASTNode and sets it to NULL, if appropriate, i.e. More... | |
char | ASTNode_getCharacter (const ASTNode_t *node) |
ASTNode_t * | ASTNode_getChild (const ASTNode_t *node, unsigned int n) |
const char * | ASTNode_getClass (const ASTNode_t *node) |
Get the mathml class of this ASTNode. More... | |
long | ASTNode_getDenominator (const ASTNode_t *node) |
long | ASTNode_getExponent (const ASTNode_t *node) |
const char * | ASTNode_getId (const ASTNode_t *node) |
Get the mathml id of this ASTNode. More... | |
long | ASTNode_getInteger (const ASTNode_t *node) |
ASTNode_t * | ASTNode_getLeftChild (const ASTNode_t *node) |
List_t * | ASTNode_getListOfNodes (const ASTNode_t *node, ASTNodePredicate predicate) |
Performs a depth-first search (DFS) of the tree rooted at node and returns the List of nodes where predicate(node) returns true. More... | |
double | ASTNode_getMantissa (const ASTNode_t *node) |
const char * | ASTNode_getName (const ASTNode_t *node) |
unsigned int | ASTNode_getNumChildren (const ASTNode_t *node) |
long | ASTNode_getNumerator (const ASTNode_t *node) |
unsigned int | ASTNode_getNumSemanticsAnnotations (ASTNode_t *node) |
Get the number of semantic annotation elements inside this node. More... | |
SBase_t * | ASTNode_getParentSBMLObject (ASTNode_t *node) |
Returns the parent SBML structure of the given ASTNode_t structure. More... | |
int | ASTNode_getPrecedence (const ASTNode_t *node) |
double | ASTNode_getReal (const ASTNode_t *node) |
ASTNode_t * | ASTNode_getRightChild (const ASTNode_t *node) |
XMLNode_t * | ASTNode_getSemanticsAnnotation (ASTNode_t *node, unsigned int n) |
Get the nth semantic annotation of this node. More... | |
const char * | ASTNode_getStyle (const ASTNode_t *node) |
Get the mathml style of this ASTNode. More... | |
ASTNodeType_t | ASTNode_getType (const ASTNode_t *node) |
const char * | ASTNode_getUnits (const ASTNode_t *node) |
Get the units of this ASTNode. More... | |
void * | ASTNode_getUserData (ASTNode_t *node) |
Returns the user data that has been previously set by setUserData(). More... | |
int | ASTNode_hasCorrectNumberArguments (ASTNode_t *node) |
Predicate returning non-zero (true) or zero (false) depending on whether this ASTNode has the correct number of children for it's type. More... | |
int | ASTNode_hasUnits (const ASTNode_t *node) |
Predicate returning true (non-zero) if this node or any of its children nodes have sbml:units. More... | |
int | ASTNode_insertChild (ASTNode_t *node, unsigned int n, ASTNode_t *newChild) |
Insert the second ASTNode_t structure at point n in the list of children of the first ASTNode_t structure. More... | |
int | ASTNode_isAvogadro (const ASTNode_t *node) |
int | ASTNode_isBoolean (const ASTNode_t *node) |
int | ASTNode_isConstant (const ASTNode_t *node) |
int | ASTNode_isFunction (const ASTNode_t *node) |
int | ASTNode_isInfinity (const ASTNode_t *node) |
int | ASTNode_isInteger (const ASTNode_t *node) |
int | ASTNode_isLambda (const ASTNode_t *node) |
int | ASTNode_isLog10 (const ASTNode_t *node) |
int | ASTNode_isLogical (const ASTNode_t *node) |
int | ASTNode_isName (const ASTNode_t *node) |
int | ASTNode_isNaN (const ASTNode_t *node) |
int | ASTNode_isNegInfinity (const ASTNode_t *node) |
int | ASTNode_isNumber (const ASTNode_t *node) |
int | ASTNode_isOperator (const ASTNode_t *node) |
int | ASTNode_isPiecewise (const ASTNode_t *node) |
int | ASTNode_isRational (const ASTNode_t *node) |
int | ASTNode_isReal (const ASTNode_t *node) |
int | ASTNode_isRelational (const ASTNode_t *node) |
int | ASTNode_isSetClass (const ASTNode_t *node) |
int | ASTNode_isSetId (const ASTNode_t *node) |
int | ASTNode_isSetStyle (const ASTNode_t *node) |
int | ASTNode_isSetUnits (const ASTNode_t *node) |
Predicate returning true (non-zero) if this node has sbml:units. More... | |
int | ASTNode_isSqrt (const ASTNode_t *node) |
int | ASTNode_isUMinus (const ASTNode_t *node) |
int | ASTNode_isUnknown (const ASTNode_t *node) |
int | ASTNode_isUPlus (const ASTNode_t *node) |
int | ASTNode_isWellFormedASTNode (ASTNode_t *node) |
Predicate returning non-zero (true) or zero (false) depending on whether this ASTNode is well-formed. More... | |
int | ASTNode_prependChild (ASTNode_t *node, ASTNode_t *child) |
Adds the given node as a child of this ASTNode. More... | |
void | ASTNode_reduceToBinary (ASTNode_t *node) |
Reduces the given ASTNode_t structure to a binary tree e.g. More... | |
int | ASTNode_removeChild (ASTNode_t *node, unsigned int n) |
Removes child n of the given ASTNode_t structure. More... | |
void | ASTNode_replaceArgument (ASTNode_t *node, const char *bvar, ASTNode_t *arg) |
Replaces occurences of a name within the given ASTNode_t structure with the name/value/formula represented by the second argument ASTNode_t e.g. More... | |
int | ASTNode_replaceChild (ASTNode_t *node, unsigned int n, ASTNode_t *newChild) |
Replaces the nth child of the given ASTNode_t structure with the second ASTNode_t structure. More... | |
int | ASTNode_returnsBoolean (const ASTNode_t *node) |
int | ASTNode_returnsBooleanForModel (const ASTNode_t *node, const Model_t *model) |
int | ASTNode_setCharacter (ASTNode_t *node, char value) |
Sets the value of this ASTNode to the given character. More... | |
int | ASTNode_setClass (ASTNode_t *node, const char *className) |
Sets the mathml class of this ASTNode to className. More... | |
int | ASTNode_setId (ASTNode_t *node, const char *id) |
Sets the mathml id of this ASTNode to id. More... | |
int | ASTNode_setInteger (ASTNode_t *node, long value) |
Sets the value of this ASTNode to the given (long) integer and sets the node type to AST_INTEGER. More... | |
int | ASTNode_setName (ASTNode_t *node, const char *name) |
Sets the value of this ASTNode to the given name. More... | |
int | ASTNode_setRational (ASTNode_t *node, long numerator, long denominator) |
Sets the value of this ASTNode to the given rational in two parts: the numerator and denominator. More... | |
int | ASTNode_setReal (ASTNode_t *node, double value) |
Sets the value of this ASTNode to the given real (double) and sets the node type to AST_REAL. More... | |
int | ASTNode_setRealWithExponent (ASTNode_t *node, double mantissa, long exponent) |
Sets the value of this ASTNode to the given real (double) in two parts: the mantissa and the exponent. More... | |
int | ASTNode_setStyle (ASTNode_t *node, const char *style) |
Sets the mathml style of this ASTNode to style. More... | |
int | ASTNode_setType (ASTNode_t *node, ASTNodeType_t type) |
Sets the type of this ASTNode to the given ASTNodeType_t. More... | |
int | ASTNode_setUnits (ASTNode_t *node, const char *units) |
Sets the units of this ASTNode to units. More... | |
int | ASTNode_setUserData (ASTNode_t *node, void *userData) |
Sets the user data of this node. More... | |
int | ASTNode_swapChildren (ASTNode_t *node, ASTNode_t *that) |
Swap the children of this ASTNode with the children of that ASTNode. More... | |
int | ASTNode_unsetClass (ASTNode_t *node) |
Unsets the mathml class of this ASTNode. More... | |
int | ASTNode_unsetId (ASTNode_t *node) |
Unsets the mathml id of this ASTNode. More... | |
int | ASTNode_unsetStyle (ASTNode_t *node) |
Unsets the mathml style of this ASTNode. More... | |
int | ASTNode_unsetUnits (ASTNode_t *node) |
Unsets the units of this ASTNode. More... | |
Variables | |
static const char * | AST_CONSTANT_STRINGS [] |
static const char * | AST_FUNCTION_STRINGS [] |
static const char * | AST_LAMBDA_STRING = "lambda" |
String Constants. More... | |
static const char * | AST_LOGICAL_STRINGS [] |
static const char * | AST_OPERATOR_STRINGS [] |
static const char * | AST_RELATIONAL_STRINGS [] |
#define ASTNodeType_isAvogadro | ( | t | ) | (t == AST_NAME_AVOGADRO) |
ASTNodeType predicates.
#define ASTNodeType_isConstant | ( | t | ) | (((t >= AST_CONSTANT_E) && (t <= AST_CONSTANT_TRUE)) || t == AST_NAME_AVOGADRO) |
#define ASTNodeType_isFunction | ( | t | ) | ((t >= AST_FUNCTION) && (t <= AST_FUNCTION_TANH)) |
#define ASTNodeType_isInteger | ( | t | ) | (t == AST_INTEGER) |
#define ASTNodeType_isLambda | ( | t | ) | (t == AST_LAMBDA) |
#define ASTNodeType_isLogical | ( | t | ) | ((t >= AST_LOGICAL_AND) && (t <= AST_LOGICAL_XOR)) |
#define ASTNodeType_isName | ( | t | ) | ((t >= AST_NAME) && (t <= AST_NAME_TIME)) |
#define ASTNodeType_isNumber | ( | t | ) | (ASTNodeType_isInteger(t) || ASTNodeType_isReal(t)) |
#define ASTNodeType_isOperator | ( | t | ) |
#define ASTNodeType_isRational | ( | t | ) | (t == AST_RATIONAL) |
#define ASTNodeType_isReal | ( | t | ) | ((t >= AST_REAL) && (t <= AST_RATIONAL)) |
#define ASTNodeType_isRelational | ( | t | ) | ((t >= AST_RELATIONAL_EQ) && (t <= AST_RELATIONAL_NEQ)) |
#define ASTNodeType_isUnknown | ( | t | ) | (t == AST_UNKNOWN) |
int ASTNode_addChild | ( | ASTNode_t * | node, |
ASTNode_t * | child | ||
) |
Adds the given node as a child of this ASTNode.
Child nodes are added in-order from "left-to-right".
int ASTNode_addSemanticsAnnotation | ( | ASTNode_t * | node, |
XMLNode_t * | annotation | ||
) |
Adds the given XMLNode as a semantic annotation of this ASTNode.
node | the ASTNode_t to which the annotation is to be added. |
annotation | the XMLNode_t representing the annotation to add. |
int ASTNode_canonicalize | ( | ASTNode_t * | node | ) |
Attempts to convert this ASTNode to a canonical form and returns true (non-zero) if the conversion succeeded, false (0) otherwise.
Attempts to convert this ASTNode to a canonical form and returns true
(non-zero) if the conversion succeeded, false
(0) otherwise.
The rules determining the canonical form conversion are as follows:
1. If the node type is AST_NAME and the node name matches "ExponentialE", "Pi", "True" or "False" the node type is converted to the corresponding AST_CONSTANT type.
2. If the node type is an AST_FUNCTION and the node name matches an L1 or L2 (MathML) function name, logical operator name, or relational operator name, the node is converted to the correspnding AST_FUNCTION, AST_LOGICAL or AST_CONSTANT type.
L1 function names are searched first, so canonicalizing "log" will result in a node type of AST_FUNCTION_LN (see L1 Specification, Appendix C).
Some canonicalizations result in a structural converion of the nodes (by adding a child). For example, a node with L1 function name "sqr" and a single child node (the argument) will be transformed to a node of type AST_FUNCTION_POWER with two children. The first child will remain unchanged, but the second child will be an ASTNode of type AST_INTEGER and a value of 2. The function names that result in structural changes are: log10, sqr and sqrt.
ASTNode_t* ASTNode_create | ( | void | ) |
Creates a new ASTNode and returns a pointer to it.
The returned node will have a type of AST_UNKNOWN and should be set to something else as soon as possible.
ASTNode_t* ASTNode_createFromToken | ( | Token_t * | token | ) |
ASTNode_t* ASTNode_createWithType | ( | ASTNodeType_t | type | ) |
Creates a new ASTNode and sets its type to the given ASTNodeType.
ASTNode_t* ASTNode_deepCopy | ( | const ASTNode_t * | node | ) |
void ASTNode_fillListOfNodes | ( | const ASTNode_t * | node, |
ASTNodePredicate | predicate, | ||
List_t * | lst | ||
) |
This method is identical in functionality to ASTNode_getListOfNodes(), except the List is passed-in by the caller.
void ASTNode_free | ( | ASTNode_t * | node | ) |
Frees the given ASTNode including any child nodes.
int ASTNode_freeName | ( | ASTNode_t * | node | ) |
Frees the name of this ASTNode and sets it to NULL, if appropriate, i.e.
Frees the name of this ASTNode and sets it to NULL
.
the node is not an operator, number or AST_UNKNOWN.
char ASTNode_getCharacter | ( | const ASTNode_t * | node | ) |
ASTNode_t* ASTNode_getChild | ( | const ASTNode_t * | node, |
unsigned int | n | ||
) |
const char* ASTNode_getClass | ( | const ASTNode_t * | node | ) |
long ASTNode_getDenominator | ( | const ASTNode_t * | node | ) |
long ASTNode_getExponent | ( | const ASTNode_t * | node | ) |
const char* ASTNode_getId | ( | const ASTNode_t * | node | ) |
long ASTNode_getInteger | ( | const ASTNode_t * | node | ) |
ASTNode_t* ASTNode_getLeftChild | ( | const ASTNode_t * | node | ) |
List_t* ASTNode_getListOfNodes | ( | const ASTNode_t * | node, |
ASTNodePredicate | predicate | ||
) |
Performs a depth-first search (DFS) of the tree rooted at node and returns the List of nodes where predicate(node) returns true.
Performs a depth-first search (DFS) of the tree rooted at node and returns the List of nodes where predicate(node) returns true
.
The typedef for ASTNodePredicate is:
int (*ASTNodePredicate) (const ASTNode_t *node);
where a return value of non-zero represents true and zero represents false.
The List returned is owned by the caller and should be freed with List_free(). The ASTNodes in the list, however, are not owned by the caller (as they still belong to the tree itself) and therefore should not be freed. That is, do not call List_freeItems().
double ASTNode_getMantissa | ( | const ASTNode_t * | node | ) |
const char* ASTNode_getName | ( | const ASTNode_t * | node | ) |
unsigned int ASTNode_getNumChildren | ( | const ASTNode_t * | node | ) |
long ASTNode_getNumerator | ( | const ASTNode_t * | node | ) |
unsigned int ASTNode_getNumSemanticsAnnotations | ( | ASTNode_t * | node | ) |
Get the number of semantic annotation elements inside this node.
node | the ASTNode_t structure to query. |
SBase_t* ASTNode_getParentSBMLObject | ( | ASTNode_t * | node | ) |
Returns the parent SBML structure of the given ASTNode_t structure.
node | the ASTNode_t of which to return the parent. |
int ASTNode_getPrecedence | ( | const ASTNode_t * | node | ) |
double ASTNode_getReal | ( | const ASTNode_t * | node | ) |
This function performs the necessary arithmetic if the node type is AST_REAL_E (mantissa * $10^exponent$) or AST_RATIONAL (numerator / denominator).
ASTNode_t* ASTNode_getRightChild | ( | const ASTNode_t * | node | ) |
ASTNode_getChild(node, ASTNode_getNumChildren(node) - 1);
XMLNode_t* ASTNode_getSemanticsAnnotation | ( | ASTNode_t * | node, |
unsigned int | n | ||
) |
Get the nth semantic annotation of this node.
node | the ASTNode_t structure to query. |
n | unsigned int the index of the annotation to be retrieved. |
n > ASTNode_getNumSemanticsAnnotations() - 1
). const char* ASTNode_getStyle | ( | const ASTNode_t * | node | ) |
ASTNodeType_t ASTNode_getType | ( | const ASTNode_t * | node | ) |
const char* ASTNode_getUnits | ( | const ASTNode_t * | node | ) |
void* ASTNode_getUserData | ( | ASTNode_t * | node | ) |
Returns the user data that has been previously set by setUserData().
node | defines the node of interest. |
int ASTNode_hasCorrectNumberArguments | ( | ASTNode_t * | node | ) |
Predicate returning non-zero (true) or zero (false) depending on whether this ASTNode has the correct number of children for it's type.
For example, an ASTNode with type AST_PLUS expects 2 child nodes.
node | defines the node of interest. |
int ASTNode_hasUnits | ( | const ASTNode_t * | node | ) |
Predicate returning true (non-zero) if this node or any of its children nodes have sbml:units.
int ASTNode_insertChild | ( | ASTNode_t * | node, |
unsigned int | n, | ||
ASTNode_t * | newChild | ||
) |
Insert the second ASTNode_t structure at point n in the list of children of the first ASTNode_t structure.
node | the ASTNode_t within which to insert a child. |
n | unsigned int the index of the ASTNode_t being added |
newChild | ASTNode_t to insert as the nth child |
int ASTNode_isAvogadro | ( | const ASTNode_t * | node | ) |
int ASTNode_isBoolean | ( | const ASTNode_t * | node | ) |
int ASTNode_isConstant | ( | const ASTNode_t * | node | ) |
int ASTNode_isFunction | ( | const ASTNode_t * | node | ) |
int ASTNode_isInfinity | ( | const ASTNode_t * | node | ) |
int ASTNode_isInteger | ( | const ASTNode_t * | node | ) |
int ASTNode_isLambda | ( | const ASTNode_t * | node | ) |
int ASTNode_isLog10 | ( | const ASTNode_t * | node | ) |
More precisley, the node type is AST_FUNCTION_LOG with two children the first of which is an AST_INTEGER equal to 10.
int ASTNode_isLogical | ( | const ASTNode_t * | node | ) |
int ASTNode_isName | ( | const ASTNode_t * | node | ) |
int ASTNode_isNaN | ( | const ASTNode_t * | node | ) |
int ASTNode_isNegInfinity | ( | const ASTNode_t * | node | ) |
int ASTNode_isNumber | ( | const ASTNode_t * | node | ) |
This is functionally equivalent to:
ASTNode_isInteger(node) || ASTNode_isReal(node).
int ASTNode_isOperator | ( | const ASTNode_t * | node | ) |
int ASTNode_isPiecewise | ( | const ASTNode_t * | node | ) |
int ASTNode_isRational | ( | const ASTNode_t * | node | ) |
int ASTNode_isReal | ( | const ASTNode_t * | node | ) |
To be a represented as a real number, this node must be of one of the following types: AST_REAL, AST_REAL_E or AST_RATIONAL.
int ASTNode_isRelational | ( | const ASTNode_t * | node | ) |
int ASTNode_isSetClass | ( | const ASTNode_t * | node | ) |
int ASTNode_isSetId | ( | const ASTNode_t * | node | ) |
int ASTNode_isSetStyle | ( | const ASTNode_t * | node | ) |
int ASTNode_isSetUnits | ( | const ASTNode_t * | node | ) |
Predicate returning true (non-zero) if this node has sbml:units.
Only applies to cn elements.
int ASTNode_isSqrt | ( | const ASTNode_t * | node | ) |
More precisley, the node type is AST_FUNCTION_ROOT with two children the first of which is an AST_INTEGER equal to 2.
int ASTNode_isUMinus | ( | const ASTNode_t * | node | ) |
For numbers, unary minus nodes can be "collapsed" by negating the number. In fact, SBML_parseFormula() does this during its parse. However, unary minus nodes for symbols (AST_NAMES) cannot be "collapsed", so this predicate function is necessary.
A node is defined as a unary minus node if it is of type AST_MINUS and has exactly one child.
int ASTNode_isUnknown | ( | const ASTNode_t * | node | ) |
int ASTNode_isUPlus | ( | const ASTNode_t * | node | ) |
int ASTNode_isWellFormedASTNode | ( | ASTNode_t * | node | ) |
Predicate returning non-zero (true) or zero (false) depending on whether this ASTNode is well-formed.
node | defines the node of interest. |
int ASTNode_prependChild | ( | ASTNode_t * | node, |
ASTNode_t * | child | ||
) |
Adds the given node as a child of this ASTNode.
This method adds child nodes from "right-to-left".
void ASTNode_reduceToBinary | ( | ASTNode_t * | node | ) |
Reduces the given ASTNode_t structure to a binary tree e.g.
if the formula in this ASTNode is and(x, y, z) then the formula of the reduced node would be and(and(x, y), z)
node | the ASTNode_t structure to reduce |
int ASTNode_removeChild | ( | ASTNode_t * | node, |
unsigned int | n | ||
) |
Removes child n of the given ASTNode_t structure.
node | the ASTNode_t from which to remove a child. |
n | unsigned int the index of the child to remove |
void ASTNode_replaceArgument | ( | ASTNode_t * | node, |
const char * | bvar, | ||
ASTNode_t * | arg | ||
) |
Replaces occurences of a name within the given ASTNode_t structure with the name/value/formula represented by the second argument ASTNode_t e.g.
if the formula in this ASTNode is x + y; bvar is x and arg is an ASTNode representing the real value 3 replaceArgument substitutes 3 for x within this ASTNode
node | the ASTNode_t structure to replace argument |
bvar | a string representing the variable name to be substituted |
arg | an ASTNode representing the name/value/formula to substitute |
int ASTNode_replaceChild | ( | ASTNode_t * | node, |
unsigned int | n, | ||
ASTNode_t * | newChild | ||
) |
Replaces the nth child of the given ASTNode_t structure with the second ASTNode_t structure.
node | the ASTNode_t within which to replace a child. |
n | unsigned int the index of the child to replace |
newChild | ASTNode_t structure to replace the nth child |
int ASTNode_returnsBoolean | ( | const ASTNode_t * | node | ) |
int ASTNode_returnsBooleanForModel | ( | const ASTNode_t * | node, |
const Model_t * | model | ||
) |
int ASTNode_setCharacter | ( | ASTNode_t * | node, |
char | value | ||
) |
Sets the value of this ASTNode to the given character.
If character is one of '+', '-', '*', '/' or '\^', the node type will be set accordingly. For all other characters, the node type will be set to AST_UNKNOWN.
int ASTNode_setClass | ( | ASTNode_t * | node, |
const char * | className | ||
) |
int ASTNode_setId | ( | ASTNode_t * | node, |
const char * | id | ||
) |
int ASTNode_setInteger | ( | ASTNode_t * | node, |
long | value | ||
) |
Sets the value of this ASTNode to the given (long) integer and sets the node type to AST_INTEGER.
Sets the value of this ASTNode to the given (long) integer and sets the node type to AST_INTEGER
.
int ASTNode_setName | ( | ASTNode_t * | node, |
const char * | name | ||
) |
Sets the value of this ASTNode to the given name.
The node type will be set (to AST_NAME) ONLY IF the ASTNode was previously an operator (ASTNode_isOperator(node) != 0) or number (ASTNode_isNumber(node) != 0). This allows names to be set for AST_FUNCTIONs and the like.
int ASTNode_setRational | ( | ASTNode_t * | node, |
long | numerator, | ||
long | denominator | ||
) |
Sets the value of this ASTNode to the given rational in two parts: the numerator and denominator.
The node type is set to AST_RATIONAL.
int ASTNode_setReal | ( | ASTNode_t * | node, |
double | value | ||
) |
Sets the value of this ASTNode to the given real (double) and sets the node type to AST_REAL.
Sets the value of this ASTNode to the given real (double) and sets the node type to AST_REAL
.
This is functionally equivalent to:
ASTNode_setRealWithExponent(node, value, 0);
int ASTNode_setRealWithExponent | ( | ASTNode_t * | node, |
double | mantissa, | ||
long | exponent | ||
) |
Sets the value of this ASTNode to the given real (double) in two parts: the mantissa and the exponent.
The node type is set to AST_REAL_E.
int ASTNode_setStyle | ( | ASTNode_t * | node, |
const char * | style | ||
) |
int ASTNode_setType | ( | ASTNode_t * | node, |
ASTNodeType_t | type | ||
) |
Sets the type of this ASTNode to the given ASTNodeType_t.
Sets the type of this ASTNode to the given ASTNodeType_t value.
int ASTNode_setUnits | ( | ASTNode_t * | node, |
const char * | units | ||
) |
Sets the units of this ASTNode to units.
The units will be set only if the ASTNode represents an <cn> element. Use isNumber().
node | the ASTNode to set |
units | string representing units |
int ASTNode_setUserData | ( | ASTNode_t * | node, |
void * | userData | ||
) |
Sets the user data of this node.
This can be used by the application developer to attach custom information to the node. In case of a deep copy this attribute will passed as it is. The attribute will be never interpreted by this class.
node | defines the node of which the user data should be set. |
userData | specifies the new user data. |
int ASTNode_swapChildren | ( | ASTNode_t * | node, |
ASTNode_t * | that | ||
) |
Swap the children of this ASTNode with the children of that ASTNode.
node | the first ASTNode_t structure |
that | ASTNode_t structure with which children will swapped |
int ASTNode_unsetClass | ( | ASTNode_t * | node | ) |
Unsets the mathml class of this ASTNode.
int ASTNode_unsetId | ( | ASTNode_t * | node | ) |
Unsets the mathml id of this ASTNode.
int ASTNode_unsetStyle | ( | ASTNode_t * | node | ) |
Unsets the mathml style of this ASTNode.
int ASTNode_unsetUnits | ( | ASTNode_t * | node | ) |
Unsets the units of this ASTNode.
|
static |
|
static |
|
static |
String Constants.
|
static |
|
static |
|
static |