|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjigcell.xpp.CPPExpression
public class CPPExpression
This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.
| Field Summary | |
|---|---|
private static java.util.Hashtable |
associative
|
private static boolean |
DEBUG
|
static int |
DONT_LOOKUP_SYMBOLS
|
private java.util.ArrayList |
expression
|
private SymbolTable |
localSymbols
|
static int |
LOOKUP_BY_ID
|
static int |
LOOKUP_BY_NAME
|
private static java.util.Hashtable |
map
|
private int |
mode
|
private java.lang.String |
modeString
|
static int |
NORMAL
|
private static java.util.Hashtable |
order
|
private SymbolTable |
symbolTable
|
| Constructor Summary | |
|---|---|
CPPExpression(jigcell.sbml2.math.MathMLExpression mathML)
|
|
CPPExpression(jigcell.sbml2.math.Node parseTree)
|
|
CPPExpression(jigcell.sbml2.math.Node parseTree,
int mode)
|
|
CPPExpression(SymbolTable st,
jigcell.sbml2.math.MathMLExpression mathML)
|
|
CPPExpression(SymbolTable st,
jigcell.sbml2.math.Node parseTree)
|
|
CPPExpression(SymbolTable st,
jigcell.sbml2.math.Node parseTree,
int mode)
|
|
CPPExpression(SymbolTable ls,
SymbolTable st,
jigcell.sbml2.math.MathMLExpression mathML)
|
|
CPPExpression(SymbolTable ls,
SymbolTable st,
jigcell.sbml2.math.Node parseTree)
|
|
CPPExpression(SymbolTable ls,
SymbolTable st,
jigcell.sbml2.math.Node parseTree,
int mode)
|
|
| Method Summary | |
|---|---|
static java.lang.String |
formatReal(double number)
|
static java.lang.String |
formatReal(java.lang.String number)
Takes a number in a string and ensures it ends in "_R8" and has a decimal place. |
private java.util.ArrayList |
genExpression(jigcell.sbml2.math.Node current)
Convert a parse tree into Fortran 90 code. |
java.lang.String |
getExpression()
|
java.lang.String |
getExpression(java.lang.String indent,
int width)
|
java.lang.String |
getExpression(java.lang.String indent,
int width,
java.lang.String prefix)
|
java.lang.Integer |
getOrder(jigcell.sbml2.math.Node node)
|
private java.lang.String |
getSymbol(java.lang.String name)
Follows the correct logic for this CPPExpression to get a symbol for name. |
private void |
initMaps()
|
static java.lang.String |
mergeExpression(java.util.ArrayList expression,
java.lang.String indent,
int width,
java.lang.String prefix)
Merges strings in expression and addes line breaks to maintain a width no greater than width. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.ArrayList expression
private SymbolTable localSymbols
private int mode
private java.lang.String modeString
private SymbolTable symbolTable
private static java.util.Hashtable map
private static java.util.Hashtable order
private static java.util.Hashtable associative
private static final boolean DEBUG
public static final int LOOKUP_BY_ID
public static final int LOOKUP_BY_NAME
public static final int DONT_LOOKUP_SYMBOLS
public static final int NORMAL
| Constructor Detail |
|---|
public CPPExpression(SymbolTable ls,
SymbolTable st,
jigcell.sbml2.math.Node parseTree,
int mode)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(SymbolTable ls,
SymbolTable st,
jigcell.sbml2.math.Node parseTree)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(SymbolTable ls,
SymbolTable st,
jigcell.sbml2.math.MathMLExpression mathML)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(SymbolTable st,
jigcell.sbml2.math.MathMLExpression mathML)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(SymbolTable st,
jigcell.sbml2.math.Node parseTree,
int mode)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(SymbolTable st,
jigcell.sbml2.math.Node parseTree)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(jigcell.sbml2.math.MathMLExpression mathML)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(jigcell.sbml2.math.Node parseTree)
throws java.lang.Exception
java.lang.Exception
public CPPExpression(jigcell.sbml2.math.Node parseTree,
int mode)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
private void initMaps()
private java.util.ArrayList genExpression(jigcell.sbml2.math.Node current)
throws java.lang.Exception
When identifiers are reached they are looked up in the symbol table. If a Fortran identifier is not found then an Exception is thrown.
case 1 cn, ci, true, false, exponentiale These are terminal nodes and will return a literal, identifier, or constant.
case 2 eq, neq, gt, lt, geq, leq, divide, power, and, or, times, plus These are nodes with 2 operands. Recursion will be performed on the operands and the first will be placed left of the operator and the second will be placed right of the operator. Parenthesis will be added around a child if it is an operator of lower precidence than the current one.
case 3 minus These are nodes with 1 or 2 operands. If there is only one then the operand is placed to the right of the operator. Otherwise this node is treated like a binary node.
case 4 root, log, xor Special functions that are builtin. Sometimes these are implemented inline because they have no Fortran equivalent.
case 5 abs, exp, ln, floor, ceiling, not, and all Fortran supported trig functions Generate the appropriate Fortran function and pass as an argument the child.
case 6 erf User defined functions with one of these as their name are replaced with a Biopack builtin or Fortran builtin function. This is specific to Biopack and will not work with other simulators.
case 7 function A user defined function with arbitrary arguments. Generate "USERFUNC( ARGS )".
default case csymbol, nan, inf, piecewise, piece, otherwise, diff, pi, factorial These nodes are unrecognized, unhandlable, or not yet implemented and will cause an Exception.
java.lang.Exception
private java.lang.String getSymbol(java.lang.String name)
throws java.lang.Exception
java.lang.Exception
public static java.lang.String mergeExpression(java.util.ArrayList expression,
java.lang.String indent,
int width,
java.lang.String prefix)
public java.lang.String getExpression()
public java.lang.String getExpression(java.lang.String indent,
int width)
public java.lang.String getExpression(java.lang.String indent,
int width,
java.lang.String prefix)
public java.lang.Integer getOrder(jigcell.sbml2.math.Node node)
throws java.lang.Exception
java.lang.Exceptionpublic static java.lang.String formatReal(java.lang.String number)
public static java.lang.String formatReal(double number)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||