libSBML Python API
5.20.2
|
long
ASTNode.getType() returns the type of this AST node. bool
ASTNode.isConstant() returns True
if this AST node is a MathML constant (True
, False
, pi
, exponentiale
), False
otherwise. bool
ASTNode.isBoolean() returns True
if this AST node returns a Boolean value (by being either a logical operator, a relational operator, or the constant True
or False
). bool
ASTNode.isFunction() returns True
if this AST node is a function (i.e., a MathML defined function such as exp
or else a function defined by a FunctionDefinition in the Model). bool
ASTNode.isInfinity() returns True
if this AST node is the special IEEE 754 value infinity. bool
ASTNode.isInteger() returns True
if this AST node is holding an integer value. bool
ASTNode.isNumber() returns True
if this AST node is holding any number. bool
ASTNode.isLambda() returns True
if this AST node is a MathML lambda
construct. bool
ASTNode.isLog10() returns True
if this AST node represents the log10
function, specifically, that its type is AST_FUNCTION_LOG
and it has two children, the first of which is an integer equal to 10. bool
ASTNode.isLogical() returns True
if this AST node is a logical operator (and
, or
, not
, xor
). bool
ASTNode.isName() returns True
if this AST node is a user-defined name or (in SBML Level 2) one of the two special csymbol
constructs "delay" or "time". bool
ASTNode.isNaN() returns True
if this AST node has the special IEEE 754 value "not a number" (NaN). bool
ASTNode.isNegInfinity() returns True
if this AST node has the special IEEE 754 value of negative infinity. bool
ASTNode.isOperator() returns True
if this AST node is an operator (e.g., +
, -
, etc.) bool
ASTNode.isPiecewise() returns True
if this AST node is the MathML piecewise
function. bool
ASTNode.isRational() returns True
if this AST node is a rational number having a numerator and a denominator. bool
ASTNode.isReal() returns True
if this AST node is a real number (specifically, AST_REAL_E
or AST_RATIONAL
). bool
ASTNode.isRelational() returns True
if this AST node is a relational operator. bool
ASTNode.isSqrt() returns True
if this AST node is the square-root operator bool
ASTNode.isUMinus() returns True
if this AST node is a unary minus. bool
ASTNode.isUnknown() returns True
if this AST node's type is unknown. Programs manipulating AST node structures should check the type of a given node before calling methods that return a value from the node. The following are the ASTNode object methods available for returning values from nodes:
long
ASTNode.getInteger() char
ASTNode.getCharacter() string
ASTNode.getName() long
ASTNode.getNumerator() long
ASTNode.getDenominator() float
ASTNode.getReal() float
ASTNode.getMantissa() long
ASTNode.getExponent() Of course, all of this would be of little use if libSBML didn't also provide methods for setting the values of AST node objects! And it does. The methods are the following:
+
, -
, *
, /
or ^
, the node type will be to the appropriate operator type. For all other characters, the node type will be set to AST_UNKNOWN AST_NAME
) only if the AST node was previously an operator (isOperator(node) != 0
) or number (isNumber(node) != 0
). This allows names to be set for AST_FUNCTIONs
and the like. AST_RATIONAL
. AST_REAL
. AST_REAL_E
. Finally, ASTNode also defines some miscellaneous methods for manipulating ASTs:
ASTNode
ASTNode(long) creates a new ASTNode object and returns a pointer to it. The returned node will have the type identified by the code passed as the argument, or a type of AST_UNKNOWN if no type is explicitly given or the type code is unrecognized. unsigned int
ASTNode.getNumChildren() returns the number of children of this AST node or 0 is this node has no children. ASTNode
ASTNode.getChild(unsigned int) returns the nth child of this AST node or NULL
if this node has no nth child (n > (ASTNode.getNumChildren() - 1)
). ASTNode
ASTNode.getLeftChild() returns the left child of this AST node. This is equivalent to ASTNode.getChild(); ASTNode
ASTNode.getRightChild() returns the right child of this AST node or NULL
if this node has no right child. that
ASTNode.