ASTNodeCompiler
FormulaCompilerLibSBML
, FormulaCompilerNoPiecewise
, LibSBMLFormulaCompiler
public class FormulaCompiler extends StringTools implements ASTNodeCompiler
String
s that represent the
content of ASTNode
s. These can be used to save equations in SBML with
older than Level 2.DECIMAL_FORMAT, REAL_FORMAT, SCIENTIFIC_FORMAT, underscore
Constructor | Description |
---|---|
FormulaCompiler() |
Modifier and Type | Method | Description |
---|---|---|
ASTNodeValue |
abs(ASTNode node) |
The absolute value represented by the given
ASTNode . |
ASTNodeValue |
and(java.util.List<ASTNode> nodes) |
|
ASTNodeValue |
arccos(ASTNode node) |
|
ASTNodeValue |
arccosh(ASTNode node) |
|
ASTNodeValue |
arccot(ASTNode node) |
|
ASTNodeValue |
arccoth(ASTNode node) |
|
ASTNodeValue |
arccsc(ASTNode node) |
|
ASTNodeValue |
arccsch(ASTNode node) |
|
ASTNodeValue |
arcsec(ASTNode node) |
|
ASTNodeValue |
arcsech(ASTNode node) |
|
ASTNodeValue |
arcsin(ASTNode node) |
|
ASTNodeValue |
arcsinh(ASTNode node) |
|
ASTNodeValue |
arctan(ASTNode node) |
|
ASTNodeValue |
arctanh(ASTNode node) |
|
static java.lang.StringBuffer |
brackets(java.lang.Object sb) |
|
ASTNodeValue |
ceiling(ASTNode node) |
|
ASTNodeValue |
compile(double mantissa,
int exponent,
java.lang.String units) |
Creates an
ASTNodeValue that represents a real number in
scientific notation, i.e., mantissa * 10^exponent, and the given units. |
ASTNodeValue |
compile(double real,
java.lang.String units) |
|
ASTNodeValue |
compile(int integer,
java.lang.String units) |
|
ASTNodeValue |
compile(java.lang.String name) |
A compiler will also have to deal with a name.
|
ASTNodeValue |
compile(CallableSBase variable) |
|
ASTNodeValue |
compile(Compartment c) |
|
ASTNodeValue |
cos(ASTNode node) |
|
ASTNodeValue |
cosh(ASTNode node) |
|
ASTNodeValue |
cot(ASTNode node) |
|
ASTNodeValue |
coth(ASTNode node) |
|
ASTNodeValue |
csc(ASTNode node) |
|
ASTNodeValue |
csch(ASTNode node) |
|
ASTNodeValue |
delay(java.lang.String delayName,
ASTNode x,
ASTNode y,
java.lang.String timeUnits) |
Evaluates delay functions.
|
static java.lang.StringBuffer |
diff(java.lang.Object... subtrahents) |
Returns the difference of the given elements as StringBuffer.
|
ASTNodeValue |
eq(ASTNode left,
ASTNode right) |
Equal.
|
ASTNodeValue |
exp(ASTNode node) |
|
ASTNodeValue |
factorial(ASTNode node) |
|
ASTNodeValue |
floor(ASTNode node) |
|
ASTNodeValue |
frac(int numerator,
int denominator) |
A fraction of two int values.
|
static java.lang.StringBuffer |
frac(java.lang.Object numerator,
java.lang.Object denominator) |
Returns a fraction with the given elements as numerator and denominator.
|
ASTNodeValue |
frac(ASTNode numerator,
ASTNode denominator) |
Fraction of two
ASTNode s |
ASTNodeValue |
function(java.lang.String name,
java.util.List<ASTNode> nodes) |
|
ASTNodeValue |
function(FunctionDefinition func,
java.util.List<ASTNode> nodes) |
|
ASTNodeValue |
functionCsymbol(ASTNode csymbol) |
Process an ASTNode that contain an extended csymbol function.
|
ASTNodeValue |
geq(ASTNode left,
ASTNode right) |
Greater equal.
|
ASTNodeValue |
getConstantAvogadro(java.lang.String name) |
Creates an
ASTNodeValue that represent's Avogadro's number. |
ASTNodeValue |
getConstantE() |
|
ASTNodeValue |
getConstantFalse() |
|
ASTNodeValue |
getConstantPi() |
|
ASTNodeValue |
getConstantTrue() |
|
ASTNodeValue |
getNegativeInfinity() |
|
ASTNodeValue |
getPositiveInfinity() |
|
ASTNodeValue |
getRateOf(ASTNode nameAST) |
Returns the instantaneous rate of change, with respect to time, of an entity in the model.
|
ASTNodeValue |
gt(ASTNode left,
ASTNode right) |
Greater than.
|
ASTNodeValue |
implies(java.util.List<ASTNode> values) |
Returns the logical implies between two
ASTNode . |
ASTNodeValue |
lambda(java.util.List<ASTNode> nodes) |
The body of a
FunctionDefinition . |
ASTNodeValue |
leq(ASTNode left,
ASTNode right) |
Less equal.
|
ASTNodeValue |
ln(ASTNode node) |
Natural logarithm.
|
ASTNodeValue |
log(ASTNode node) |
Logarithm of the given value to base 10.
|
ASTNodeValue |
log(ASTNode left,
ASTNode right) |
Logarithm of the given value to the given base.
|
ASTNodeValue |
lt(ASTNode left,
ASTNode right) |
Less than.
|
ASTNodeValue |
max(java.util.List<ASTNode> values) |
Returns the maximum of the values.
|
ASTNodeValue |
min(java.util.List<ASTNode> values) |
Returns the minimum of the values.
|
ASTNodeValue |
minus(java.util.List<ASTNode> nodes) |
Subtraction.
|
ASTNodeValue |
neq(ASTNode left,
ASTNode right) |
Not equal.
|
ASTNodeValue |
not(ASTNode node) |
|
ASTNodeValue |
or(java.util.List<ASTNode> nodes) |
|
ASTNodeValue |
piecewise(java.util.List<ASTNode> nodes) |
|
ASTNodeValue |
plus(java.util.List<ASTNode> nodes) |
|
static java.lang.StringBuffer |
pow(java.lang.Object basis,
java.lang.Object exponent) |
Returns the basis to the power of the exponent as StringBuffer.
|
ASTNodeValue |
pow(ASTNode left,
ASTNode right) |
|
ASTNodeValue |
quotient(java.util.List<ASTNode> values) |
Returns the quotient of the division of the values.
|
ASTNodeValue |
rem(java.util.List<ASTNode> values) |
Returns the remainder of the division of the values.
|
ASTNodeValue |
root(double rootExponent,
ASTNode radiant) |
|
static java.lang.StringBuffer |
root(java.lang.Object exponent,
java.lang.Object basis) |
Returns the exponent-th root of the basis as StringBuffer.
|
ASTNodeValue |
root(ASTNode rootExponent,
ASTNode radiant) |
|
ASTNodeValue |
sec(ASTNode node) |
|
ASTNodeValue |
sech(ASTNode node) |
|
ASTNodeValue |
selector(java.util.List<ASTNode> nodes) |
|
ASTNodeValue |
sin(ASTNode node) |
|
ASTNodeValue |
sinh(ASTNode node) |
|
static java.lang.StringBuffer |
sqrt(java.lang.Object basis) |
|
ASTNodeValue |
sqrt(ASTNode node) |
Square root.
|
static java.lang.StringBuffer |
sum(java.lang.Object... summands) |
Returns the sum of the given elements as StringBuffer.
|
ASTNodeValue |
symbolTime(java.lang.String time) |
The simulation time.
|
ASTNodeValue |
tan(ASTNode node) |
|
ASTNodeValue |
tanh(ASTNode node) |
|
static java.lang.StringBuffer |
times(java.lang.Object... factors) |
Returns the product of the given elements as StringBuffer.
|
ASTNodeValue |
times(java.util.List<ASTNode> nodes) |
Product of all given
ASTNode s. |
ASTNodeValue |
uMinus(ASTNode node) |
Unary minus, i.e., negation of the given
ASTNode . |
ASTNodeValue |
unknownValue() |
Dealing with a malformed
ASTNode . |
ASTNodeValue |
vector(java.util.List<ASTNode> nodes) |
Dealing with a vector.
|
ASTNodeValue |
xor(java.util.List<ASTNode> nodes) |
Exclusive or.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append, append, concat, concatStringBuilder, encodeForHTML, fill, fill, firstLetterLowerCase, firstLetterUpperCase, getMessage, getWordForNumber, leadingZeros, newLine, parseSBMLBoolean, parseSBMLBooleanStrict, parseSBMLDouble, parseSBMLDoubleStrict, parseSBMLInt, parseSBMLShort, parseSBMLShortStrict, toHTML, toHTML, toString, toString, toXMLAnnotationString, toXMLMessageString, toXMLNotesString
public static final java.lang.StringBuffer brackets(java.lang.Object sb)
sb
- public static final java.lang.StringBuffer diff(java.lang.Object... subtrahents)
subtrahents
- public static final java.lang.StringBuffer frac(java.lang.Object numerator, java.lang.Object denominator)
numerator
- denominator
- public static final java.lang.StringBuffer pow(java.lang.Object basis, java.lang.Object exponent)
basis
- exponent
- public static final java.lang.StringBuffer root(java.lang.Object exponent, java.lang.Object basis) throws java.lang.NumberFormatException
exponent
- basis
- java.lang.NumberFormatException
java.util.IllegalFormatException
- If the given exponent represents a zero.public static final java.lang.StringBuffer sqrt(java.lang.Object basis)
basis
- public static final java.lang.StringBuffer sum(java.lang.Object... summands)
summands
- public static final java.lang.StringBuffer times(java.lang.Object... factors)
factors
- public ASTNodeValue abs(ASTNode node) throws SBMLException
ASTNodeCompiler
ASTNode
.abs
in interface ASTNodeCompiler
node
- Must be interpretable as a Number
.SBMLException
public ASTNodeValue and(java.util.List<ASTNode> nodes) throws SBMLException
and
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arccos(ASTNode node) throws SBMLException
arccos
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arccosh(ASTNode node) throws SBMLException
arccosh
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arccot(ASTNode node) throws SBMLException
arccot
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arccoth(ASTNode node) throws SBMLException
arccoth
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arccsc(ASTNode node) throws SBMLException
arccsc
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arccsch(ASTNode node) throws SBMLException
arccsch
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arcsec(ASTNode node) throws SBMLException
arcsec
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arcsech(ASTNode node) throws SBMLException
arcsech
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arcsin(ASTNode node) throws SBMLException
arcsin
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arcsinh(ASTNode node) throws SBMLException
arcsinh
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arctan(ASTNode node) throws SBMLException
arctan
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue arctanh(ASTNode node) throws SBMLException
arctanh
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue ceiling(ASTNode node) throws SBMLException
ceiling
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue compile(Compartment c)
compile
in interface ASTNodeCompiler
public ASTNodeValue compile(double mantissa, int exponent, java.lang.String units)
ASTNodeCompiler
ASTNodeValue
that represents a real number in
scientific notation, i.e., mantissa * 10^exponent, and the given units.compile
in interface ASTNodeCompiler
mantissa
- The number to be multiplied with ten to the power of the given
exponent.exponent
- The exponent for the multiplier ten.units
- The identifier of the units object associated with the number
represented by this element. Can be null if no units have been
defined.public ASTNodeValue compile(double real, java.lang.String units)
compile
in interface ASTNodeCompiler
units
- A String representing the Unit
of the given number.
This can be the identifier of a UnitDefinition
in the
model or a literal in Unit.Kind
. Can be null if no units
have been defined.public ASTNodeValue compile(int integer, java.lang.String units)
compile
in interface ASTNodeCompiler
units
- A String representing the Unit
of the given number.
This can be the identifier of a UnitDefinition
in the
model or a literal in Unit.Kind
. Can be null if no units
have been defined.public ASTNodeValue compile(CallableSBase variable)
compile
in interface ASTNodeCompiler
public ASTNodeValue compile(java.lang.String name)
ASTNodeCompiler
Species
in the
system. In case of numerical computation, the ASTNodeCompiler
must create an ASTNodeValue
representing the current value of
this Species
.compile
in interface ASTNodeCompiler
public ASTNodeValue cos(ASTNode node) throws SBMLException
cos
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue cosh(ASTNode node) throws SBMLException
cosh
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue cot(ASTNode node) throws SBMLException
cot
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue coth(ASTNode node) throws SBMLException
coth
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue csc(ASTNode node) throws SBMLException
csc
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue csch(ASTNode node) throws SBMLException
csch
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue delay(java.lang.String delayName, ASTNode x, ASTNode y, java.lang.String timeUnits) throws SBMLException
ASTNodeCompiler
delay
in interface ASTNodeCompiler
delayName
- the name of this delay function.y
- an expression of a positive duration time (the amoutn of
delay)timeUnits
- the units for the delay.SBMLException
public ASTNodeValue eq(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
eq
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue exp(ASTNode node) throws SBMLException
exp
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue factorial(ASTNode node)
factorial
in interface ASTNodeCompiler
public ASTNodeValue floor(ASTNode node) throws SBMLException
floor
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue frac(ASTNode numerator, ASTNode denominator) throws SBMLException
ASTNodeCompiler
ASTNode
sfrac
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue frac(int numerator, int denominator)
ASTNodeCompiler
frac
in interface ASTNodeCompiler
public ASTNodeValue function(FunctionDefinition func, java.util.List<ASTNode> nodes) throws SBMLException
function
in interface ASTNodeCompiler
nodes
- Values to be inserted into the parameter list of the
function.SBMLException
public ASTNodeValue functionCsymbol(ASTNode csymbol) throws SBMLException
ASTNodeCompiler
functionCsymbol
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue function(java.lang.String name, java.util.List<ASTNode> nodes) throws SBMLException
function
in interface ASTNodeCompiler
name
- nodes
- SBMLException
public ASTNodeValue geq(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
geq
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue getConstantAvogadro(java.lang.String name)
ASTNodeCompiler
ASTNodeValue
that represent's Avogadro's number.
Optionally, the compiler may associate the given name with this number.getConstantAvogadro
in interface ASTNodeCompiler
name
- An optional name for Avogadro's number.public ASTNodeValue getConstantE()
getConstantE
in interface ASTNodeCompiler
public ASTNodeValue getConstantFalse()
getConstantFalse
in interface ASTNodeCompiler
public ASTNodeValue getConstantPi()
getConstantPi
in interface ASTNodeCompiler
public ASTNodeValue getConstantTrue()
getConstantTrue
in interface ASTNodeCompiler
public ASTNodeValue getNegativeInfinity()
getNegativeInfinity
in interface ASTNodeCompiler
public ASTNodeValue getPositiveInfinity()
getPositiveInfinity
in interface ASTNodeCompiler
public ASTNodeValue gt(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
gt
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue lambda(java.util.List<ASTNode> nodes) throws SBMLException
ASTNodeCompiler
FunctionDefinition
.lambda
in interface ASTNodeCompiler
nodes
- Place holders for arguments.SBMLException
public ASTNodeValue leq(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
leq
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue ln(ASTNode node) throws SBMLException
ASTNodeCompiler
ln
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue log(ASTNode node) throws SBMLException
ASTNodeCompiler
log
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue log(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
log
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue lt(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
lt
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue minus(java.util.List<ASTNode> nodes) throws SBMLException
ASTNodeCompiler
minus
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue neq(ASTNode left, ASTNode right) throws SBMLException
ASTNodeCompiler
neq
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue not(ASTNode node) throws SBMLException
not
in interface ASTNodeCompiler
node
- This value must be interpretable as a Boolean
.SBMLException
public ASTNodeValue or(java.util.List<ASTNode> nodes) throws SBMLException
or
in interface ASTNodeCompiler
nodes
- These values must be interpretable as a Boolean
.SBMLException
public ASTNodeValue piecewise(java.util.List<ASTNode> nodes) throws SBMLException
piecewise
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue plus(java.util.List<ASTNode> nodes) throws SBMLException
plus
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue pow(ASTNode left, ASTNode right) throws SBMLException
pow
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue root(ASTNode rootExponent, ASTNode radiant) throws SBMLException
root
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue root(double rootExponent, ASTNode radiant) throws SBMLException
root
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue sec(ASTNode node) throws SBMLException
sec
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue sech(ASTNode node) throws SBMLException
sech
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue sin(ASTNode node) throws SBMLException
sin
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue sinh(ASTNode node) throws SBMLException
sinh
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue sqrt(ASTNode node) throws SBMLException
ASTNodeCompiler
sqrt
in interface ASTNodeCompiler
node
- This value must be interpretable as a Number
.SBMLException
public ASTNodeValue symbolTime(java.lang.String time)
ASTNodeCompiler
symbolTime
in interface ASTNodeCompiler
time
- The name of the time symbol.ASTNodeValue
that represents the current time.public ASTNodeValue tan(ASTNode node) throws SBMLException
tan
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue tanh(ASTNode node) throws SBMLException
tanh
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue times(java.util.List<ASTNode> nodes) throws SBMLException
ASTNodeCompiler
ASTNode
s.times
in interface ASTNodeCompiler
nodes
- These values must be interpretable to Number
.SBMLException
public ASTNodeValue uMinus(ASTNode node) throws SBMLException
ASTNodeCompiler
ASTNode
.uMinus
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue unknownValue() throws SBMLException
ASTNodeCompiler
ASTNode
.unknownValue
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue xor(java.util.List<ASTNode> nodes) throws SBMLException
ASTNodeCompiler
xor
in interface ASTNodeCompiler
nodes
- It must be possible to evaluate the given values to
Boolean
.SBMLException
public ASTNodeValue selector(java.util.List<ASTNode> nodes) throws SBMLException
selector
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue vector(java.util.List<ASTNode> nodes) throws SBMLException
ASTNodeCompiler
vector
in interface ASTNodeCompiler
SBMLException
public ASTNodeValue max(java.util.List<ASTNode> values)
ASTNodeCompiler
max
in interface ASTNodeCompiler
public ASTNodeValue min(java.util.List<ASTNode> values)
ASTNodeCompiler
min
in interface ASTNodeCompiler
public ASTNodeValue quotient(java.util.List<ASTNode> values)
ASTNodeCompiler
quotient
in interface ASTNodeCompiler
public ASTNodeValue rem(java.util.List<ASTNode> values)
ASTNodeCompiler
rem
in interface ASTNodeCompiler
public ASTNodeValue implies(java.util.List<ASTNode> values)
ASTNodeCompiler
implies
in interface ASTNodeCompiler
ASTNode
.public ASTNodeValue getRateOf(ASTNode nameAST)
ASTNodeCompiler
It is a function that takes a single argument, an identifier of
type SId . The allowable identifiers for use with rateOf in SBML Level 3 Version 2 Core are restricted
to those of Compartment
, LocalParameter
, Parameter
, Species
, and SpeciesReference
objects in the
enclosing model; in addition, SBML Level 3 packages may define entities with mathematical meaning
whose rateOf 's can be referenced. Note that rateOf is not allowed for Reaction
objects, because their
identifiers already represent the rate of change of the reaction, and calculating second derivatives is
beyond the scope of this construct. Likewise, there is no sensible meaning to be given to the rateOf of
a FunctionDefinition, Event, Priority, Delay, or other SBML entities.
getRateOf
in interface ASTNodeCompiler
nameAST
- an ASTNode representing an identifier