From: <ko...@us...> - 2015-06-21 23:42:10
|
Revision: 2335 http://sourceforge.net/p/jsbml/code/2335 Author: kofiav Date: 2015-06-21 23:42:08 +0000 (Sun, 21 Jun 2015) Log Message: ----------- Changed default type of ASTPowerNode to ASTNode.Type.FUNCTION_POWER instead of ASTNode.Type.POWER. Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/ASTPowerNode.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-06-21 23:25:26 UTC (rev 2334) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java 2015-06-21 23:42:08 UTC (rev 2335) @@ -621,39 +621,6 @@ } /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = -1391327698196553142L; - - /** - * The URI for the definition of the csymbol for avogadro. - */ - public static final transient String URI_AVOGADRO_DEFINITION = "http://www.sbml.org/sbml/symbols/avogadro"; - - /** - * The URI for the definition of the csymbol for delay. - */ - public static final transient String URI_DELAY_DEFINITION = "http://www.sbml.org/sbml/symbols/delay"; - - /** - * URI for the definition of MathML. - */ - public static final transient String URI_MATHML_DEFINITION = "http://www.w3.org/1998/Math/MathML"; - - // TODO: check how we set the math in level 1 - - /** - * URI prefix for the definition of MathML, it will be used to write the sbml - * file - */ - public static final String URI_MATHML_PREFIX = ""; - - /** - * The URI for the definition of the csymbol for time. - */ - public static final transient String URI_TIME_DEFINITION = "http://www.sbml.org/sbml/symbols/time"; - - /** * Creates and returns an {@link ASTNode} that computes the absolute value of * the given double value. * @@ -709,6 +676,31 @@ } /** + * 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.isName() ? n.getName() : "") + ", " + + (n.isSetUserObjects() ? n.userObjectKeySet() : " no userObject") + ", " + + (n.getParent() != null ? n.getParent().getClass().getSimpleName() : "no parent") + "\n"; + + for (ASTNode child : n.getChildren()) { + tree = astNodeToTree(child, tree, indent + " "); + } + + return tree; + } + + // TODO: check how we set the math in level 1 + + /** * Creates a new {@link ASTNode} of type MINUS and adds the given nodes as * children * @@ -1434,11 +1426,42 @@ } /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -1391327698196553142L; + + /** + * The URI for the definition of the csymbol for avogadro. + */ + public static final transient String URI_AVOGADRO_DEFINITION = "http://www.sbml.org/sbml/symbols/avogadro"; + + /** + * The URI for the definition of the csymbol for delay. + */ + public static final transient String URI_DELAY_DEFINITION = "http://www.sbml.org/sbml/symbols/delay"; + + /** + * URI for the definition of MathML. + */ + public static final transient String URI_MATHML_DEFINITION = "http://www.w3.org/1998/Math/MathML"; + + /** + * URI prefix for the definition of MathML, it will be used to write the sbml + * file + */ + public static final String URI_MATHML_PREFIX = ""; + + /** + * The URI for the definition of the csymbol for time. + */ + public static final transient String URI_TIME_DEFINITION = "http://www.sbml.org/sbml/symbols/time"; + + /** * A pointer to the {@link ASTNode2} corresponding to the current * {@link ASTNode} */ private ASTNode2 astnode2; - + /** * Child nodes. */ @@ -1726,6 +1749,14 @@ astnode2 = ASTFactory.arithmeticOperation(operator, astnode.toASTNode2()); } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractTreeNode#clearUserObjects() + */ + @Override + public void clearUserObjects() { + astnode2.clearUserObjects(); + } + /* * (non-Javadoc) * @@ -2438,6 +2469,14 @@ .containsUndeclaredUnits() : true; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractTreeNode#containsUserObjectKey(java.lang.Object) + */ + @Override + public boolean containsUserObjectKey(Object key) { + return astnode2.containsUserObjectKey(key); + } + /** * Evaluates recursively this ASTNode and creates a new UnitDefinition with * respect to all referenced elements. @@ -2698,15 +2737,6 @@ } /** - * Returns true iff listOfNodes is not equal to null - * - * @return boolean - */ - private boolean isSetListOfNodes() { - return listOfNodes != null; - } - - /** * Returns the list of children of the current ASTNode that satisfy the given * filter. * @@ -2931,6 +2961,14 @@ : null; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractTreeNode#getUserObject(java.lang.Object) + */ + @Override + public Object getUserObject(Object key) { + return astnode2.getUserObject(key); + } + /** * Returns the variable of this node. This function should be called only when * {@code isVariable()} == true}, otherwise an Exception is thrown. @@ -3307,6 +3345,15 @@ } /** + * Returns true iff listOfNodes is not equal to null + * + * @return boolean + */ + private boolean isSetListOfNodes() { + return listOfNodes != null; + } + + /** * @return */ public boolean isSetName() { @@ -3357,6 +3404,14 @@ : false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractTreeNode#isSetUserObjects() + */ + @Override + public boolean isSetUserObjects() { + return astnode2.isSetUserObjects(); + } + /** * Returns {@code true} if this node represents a square root function, * {@code false} otherwise. @@ -3619,6 +3674,14 @@ insertChild(0, child); } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractTreeNode#putUserObject(java.lang.Object, java.lang.Object) + */ + @Override + public void putUserObject(Object key, Object userObject) { + astnode2.putUserObject(key, userObject); + } + /** * Raises this ASTNode by the power of the value of the given node. * @@ -4476,70 +4539,7 @@ // 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.isName() ? n.getName() : "") + ", " + - (n.isSetUserObjects() ? n.userObjectKeySet() : " no userObject") + ", " + - (n.getParent() != null ? n.getParent().getClass().getSimpleName() : "no parent") + "\n"; - - for (ASTNode child : n.getChildren()) { - tree = astNodeToTree(child, tree, indent + " "); - } - - return tree; - } - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractTreeNode#clearUserObjects() - */ - @Override - public void clearUserObjects() { - astnode2.clearUserObjects(); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractTreeNode#containsUserObjectKey(java.lang.Object) - */ - @Override - public boolean containsUserObjectKey(Object key) { - return astnode2.containsUserObjectKey(key); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractTreeNode#getUserObject(java.lang.Object) - */ - @Override - public Object getUserObject(Object key) { - return astnode2.getUserObject(key); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractTreeNode#isSetUserObjects() - */ - @Override - public boolean isSetUserObjects() { - return astnode2.isSetUserObjects(); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractTreeNode#putUserObject(java.lang.Object, java.lang.Object) - */ - @Override - public void putUserObject(Object key, Object userObject) { - astnode2.putUserObject(key, userObject); - } - - /* (non-Javadoc) * @see org.sbml.jsbml.AbstractTreeNode#userObjectKeySet() */ @Override Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/ASTPowerNode.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/ASTPowerNode.java 2015-06-21 23:25:26 UTC (rev 2334) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/ASTPowerNode.java 2015-06-21 23:42:08 UTC (rev 2335) @@ -56,7 +56,7 @@ */ public ASTPowerNode() { super(); - setType(Type.POWER); + setType(Type.FUNCTION_POWER); } /** @@ -65,7 +65,7 @@ */ public ASTPowerNode(ASTNode2 basis, ASTNode2 exponent) { super(basis, exponent); - setType(Type.POWER); + setType(Type.FUNCTION_POWER); } /** @@ -119,7 +119,7 @@ */ @Override public boolean isAllowableType(Type type) { - return type == Type.POWER; + return type == Type.FUNCTION_POWER; } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |