From: <nik...@us...> - 2015-04-22 15:58:31
|
Revision: 2223 http://sourceforge.net/p/jsbml/code/2223 Author: niko-rodrigue Date: 2015-04-22 15:58:22 +0000 (Wed, 22 Apr 2015) Log Message: ----------- added a small utility method to ASTNode to help debug and see the structure of an ASTNode Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java 2015-04-22 15:57:10 UTC (rev 2222) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java 2015-04-22 15:58:22 UTC (rev 2223) @@ -4357,4 +4357,25 @@ // pointer to whatever they are referencing. } + /** + * Returns a simple tree view of the ASTNode internal, including mainly + * node type and hierarchy. + * + * @param n + * @param tree + * @param indent + * @return a simple tree view of the ASTNode internal + */ + public static String astNodeToTree(ASTNode n, String tree, String indent) { + tree = tree + indent + n.getType() + " " + + (n.isInteger() ? n.getInteger() : "") + (n.isReal() ? n.getReal() : "") + "\n"; + + for (ASTNode child : n.getChildren()) { + tree = astNodeToTree(child, tree, indent + " "); + } + + return tree; + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |