|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjigcell.sbml2.math.InfixExpression
public class InfixExpression
This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.
Field Summary | |
---|---|
private static java.util.Hashtable |
associative
|
static int |
DONT_LOOKUP_SYMBOLS
|
private java.util.ArrayList |
expression
|
private SymbolTable |
localSymbols
|
private boolean |
lookupSymbols
|
private static java.util.Hashtable |
map
|
static int |
NORMAL
|
private static java.util.Hashtable |
order
|
private SymbolTable |
symbolTable
|
Constructor Summary | |
---|---|
InfixExpression(MathMLExpression mathML)
|
|
InfixExpression(Node parseTree)
|
|
InfixExpression(Node parseTree,
int mode)
|
|
InfixExpression(SymbolTable st,
MathMLExpression mathML)
|
|
InfixExpression(SymbolTable st,
Node parseTree)
|
|
InfixExpression(SymbolTable ls,
SymbolTable st,
MathMLExpression mathML)
|
|
InfixExpression(SymbolTable ls,
SymbolTable st,
Node parseTree)
|
|
InfixExpression(SymbolTable ls,
SymbolTable st,
Node parseTree,
int mode)
|
Method Summary | |
---|---|
private java.util.ArrayList |
genExpression(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(Node node)
|
private static 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. |
static void |
modifyMap(java.lang.String function,
java.lang.String targetFunction)
Changes the function map to map function to targetFunction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean lookupSymbols
private java.util.ArrayList expression
private SymbolTable symbolTable
private SymbolTable localSymbols
private static java.util.Hashtable map
private static java.util.Hashtable order
private static java.util.Hashtable associative
public static final int DONT_LOOKUP_SYMBOLS
public static final int NORMAL
Constructor Detail |
---|
public InfixExpression(SymbolTable ls, SymbolTable st, Node parseTree, int mode) throws java.lang.Exception
java.lang.Exception
public InfixExpression(SymbolTable ls, SymbolTable st, Node parseTree) throws java.lang.Exception
java.lang.Exception
public InfixExpression(SymbolTable ls, SymbolTable st, MathMLExpression mathML) throws java.lang.Exception
java.lang.Exception
public InfixExpression(SymbolTable st, MathMLExpression mathML) throws java.lang.Exception
java.lang.Exception
public InfixExpression(SymbolTable st, Node parseTree) throws java.lang.Exception
java.lang.Exception
public InfixExpression(MathMLExpression mathML) throws java.lang.Exception
java.lang.Exception
public InfixExpression(Node parseTree) throws java.lang.Exception
java.lang.Exception
public InfixExpression(Node parseTree, int mode) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
private static void initMaps()
public static void modifyMap(java.lang.String function, java.lang.String targetFunction) throws java.lang.Exception
java.lang.Exception
private java.util.ArrayList genExpression(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 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
public java.lang.Integer getOrder(Node node) 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |