Author: mes
Date: 2011-11-23 16:54:00 -0800 (Wed, 23 Nov 2011)
New Revision: 27598
Added:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/AbstractNode.java
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/TreeNode.java
Removed:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/Node.java
Modified:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/EquationParser.java
core3/api/trunk/equations-api/src/test/java/org/cytoscape/equations/SimpleNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationCompilerImpl.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationParserImpl.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BinOpNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BooleanConstantNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FConvNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FloatConstantNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FuncCallNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/IdentNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/SConvNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/StringConstantNode.java
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/UnaryOpNode.java
Log:
Extracted interface and renamed Node to AbstractNode
Copied:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/AbstractNode.java
(from rev 27587,
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/Node.java)
===================================================================
---
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/AbstractNode.java
(rev 0)
+++
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/AbstractNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -0,0 +1,88 @@
+/*
+ File: Node.java
+
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.equations;
+
+
+import java.util.Stack;
+
+
+/**
+ * A node in the parse tree.
+ * @CyAPI.Abstract.Class
+ */
+public abstract class AbstractNode implements TreeNode {
+ private final int sourceLocation; // What location the "source code" is
this associated with.
+
+ /** Base class constructor for any <code>Node</code> type.
+ * @param sourceLocation start of the location in the equation where
the code was found
+ * that was turned into a node in the parse tree
+ */
+ public AbstractNode(final int sourceLocation) {
+ this.sourceLocation = sourceLocation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.cytoscape.equations.TreeNode#getSourceLocation()
+ */
+ @Override
+ public final int getSourceLocation() {
+ return sourceLocation;
+ }
+
+ /** Returns s <code>String</code> representation of this node.
+ * @return a textual representation of this node
+ * Note: This is typically only used for debugging.
+ */
+ public abstract String toString();
+
+ /* (non-Javadoc)
+ * @see org.cytoscape.equations.TreeNode#getType()
+ */
+ @Override
+ public abstract Class getType(); // The type of this node.
+
+ /* (non-Javadoc)
+ * @see org.cytoscape.equations.TreeNode#getLeftChild()
+ */
+ @Override
+ public abstract TreeNode getLeftChild();
+
+ /* (non-Javadoc)
+ * @see org.cytoscape.equations.TreeNode#getRightChild()
+ */
+ @Override
+ public abstract TreeNode getRightChild();
+
+ /* (non-Javadoc)
+ * @see org.cytoscape.equations.TreeNode#genCode(java.util.Stack)
+ */
+ @Override
+ public abstract void genCode(final Stack<CodeAndSourceLocation>
codeStack);
+}
Modified:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/EquationParser.java
===================================================================
---
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/EquationParser.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/EquationParser.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -94,5 +94,5 @@
* Returns the parse tree. Must only be called if parse() returns true!
* @return the parse tree.
*/
- Node getParseTree();
+ TreeNode getParseTree();
}
Deleted:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/Node.java
===================================================================
---
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/Node.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/Node.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -1,84 +0,0 @@
-/*
- File: Node.java
-
- Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.equations;
-
-
-import java.util.Stack;
-
-
-/**
- * A node in the parse tree.
- * @CyAPI.Abstract.Class
- */
-public abstract class Node {
- private final int sourceLocation; // What location the "source code" is
this associated with.
-
- /** Base class constructor for any <code>Node</code> type.
- * @param sourceLocation start of the location in the equation where
the code was found
- * that was turned into a node in the parse tree
- */
- public Node(final int sourceLocation) {
- this.sourceLocation = sourceLocation;
- }
-
- /** Returns the start of the location in the equation where the code
was found that was
- * turned into a node in the parse tree.
- * @return the location in the source code that resulted in this node
- */
- public final int getSourceLocation() {
- return sourceLocation;
- }
-
- /** Returns s <code>String</code> representation of this node.
- * @return a textual representation of this node
- * Note: This is typically only used for debugging.
- */
- public abstract String toString();
-
- /** Returns the type of this node.
- * @return the type of the result of the code generated from this node
will result in
- */
- public abstract Class getType(); // The type of this node.
-
- /** Returns the left child if it exists or null if it doesn't.
- * @return the left child, if any, of this node in the parse tree
- */
- public abstract Node getLeftChild();
-
- /** Returns the right child if it exists or null if it doesn't.
- * @return the right child, if any, of this node in the parse tree
- */
- public abstract Node getRightChild();
-
- /** Generated code for this node and pushes it onto the execution
stack.
- * @param codeStack the execution stack to push the generated code for
this node.
- */
- public abstract void genCode(final Stack<CodeAndSourceLocation>
codeStack);
-}
Added:
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/TreeNode.java
===================================================================
---
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/TreeNode.java
(rev 0)
+++
core3/api/trunk/equations-api/src/main/java/org/cytoscape/equations/TreeNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -0,0 +1,33 @@
+package org.cytoscape.equations;
+
+import java.util.Stack;
+
+public interface TreeNode {
+
+ /** Returns the start of the location in the equation where the code
was found that was
+ * turned into a node in the parse tree.
+ * @return the location in the source code that resulted in this node
+ */
+ int getSourceLocation();
+
+ /** Returns the type of this node.
+ * @return the type of the result of the code generated from this node
will result in
+ */
+ Class getType(); // The type of this node.
+
+ /** Returns the left child if it exists or null if it doesn't.
+ * @return the left child, if any, of this node in the parse tree
+ */
+ TreeNode getLeftChild();
+
+ /** Returns the right child if it exists or null if it doesn't.
+ * @return the right child, if any, of this node in the parse tree
+ */
+ TreeNode getRightChild();
+
+ /** Generated code for this node and pushes it onto the execution
stack.
+ * @param codeStack the execution stack to push the generated code for
this node.
+ */
+ void genCode(final Stack<CodeAndSourceLocation> codeStack);
+
+}
\ No newline at end of file
Modified:
core3/api/trunk/equations-api/src/test/java/org/cytoscape/equations/SimpleNode.java
===================================================================
---
core3/api/trunk/equations-api/src/test/java/org/cytoscape/equations/SimpleNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/api/trunk/equations-api/src/test/java/org/cytoscape/equations/SimpleNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -4,7 +4,7 @@
import java.util.Stack;
-class SimpleNode extends Node {
+class SimpleNode extends AbstractNode {
SimpleNode(final int sourceLocation) {
super(sourceLocation);
}
@@ -16,10 +16,10 @@
public Class getType() { return null; }
@Override
- public Node getLeftChild() { return null; }
+ public TreeNode getLeftChild() { return null; }
@Override
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
@Override
public void genCode(final Stack<CodeAndSourceLocation> codeStack) { }
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationCompilerImpl.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationCompilerImpl.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationCompilerImpl.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -38,7 +38,7 @@
import org.cytoscape.equations.EquationCompiler;
import org.cytoscape.equations.EquationParser;
import org.cytoscape.equations.Equation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.TreeNode;
public class EquationCompilerImpl implements EquationCompiler {
@@ -59,7 +59,7 @@
return false;
}
- final Node parseTree = parser.getParseTree();
+ final TreeNode parseTree = parser.getParseTree();
final Stack<CodeAndSourceLocation> codeStack = new
Stack<CodeAndSourceLocation>();
try {
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationParserImpl.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationParserImpl.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/EquationParserImpl.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -41,7 +41,8 @@
import org.cytoscape.equations.EquationParser;
import org.cytoscape.equations.Function;
import org.cytoscape.equations.FunctionUtil;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.builtins.*;
import org.cytoscape.equations.internal.parse_tree.*;
@@ -51,7 +52,7 @@
private Tokeniser tokeniser;
private Map<String, Function> nameToFunctionMap;
private String lastErrorMessage;
- private Node parseTree;
+ private TreeNode parseTree;
private Map<String, Class<?>> variableNameToTypeMap;
private Set<String> variableReferences;
private Map<String, Object> defaultVariableValues;
@@ -147,7 +148,7 @@
/**
* @return the parse tree. Must only be called if parse() returns
true!
*/
- public Node getParseTree() { return parseTree; }
+ public TreeNode getParseTree() { return parseTree; }
//
// The actual parsing takes place here.
@@ -156,21 +157,21 @@
/**
* Implements expr --> term | term {+ term } | term {- term} | term
{& term} | term compOp term.
*/
- private Node parseExpr() {
- Node exprNode = parseTerm();
+ private AbstractNode parseExpr() {
+ AbstractNode exprNode = parseTerm();
for (;;) {
final Token token = tokeniser.getToken();
final int sourceLocation = tokeniser.getStartPos();
if (token == Token.PLUS || token == Token.MINUS ||
token == Token.AMPERSAND) {
- final Node term = parseTerm();
+ final TreeNode term = parseTerm();
if (token == Token.PLUS || token == Token.MINUS)
exprNode =
handleBinaryArithmeticOp(token, sourceLocation, exprNode, term);
else // String concatenation.
exprNode = new
BinOpNode(sourceLocation, Token.AMPERSAND, exprNode, term);
}
else if (token.isComparisonOperator()) {
- final Node term = parseTerm();
+ final TreeNode term = parseTerm();
return handleComparisonOp(token,
sourceLocation, exprNode, term); // No chaining for comparison operators!
} else {
tokeniser.ungetToken(token);
@@ -182,14 +183,14 @@
/**
* Implements term --> power {* power} | power {/ power}
*/
- private Node parseTerm() {
- Node termNode = parsePower();
+ private AbstractNode parseTerm() {
+ AbstractNode termNode = parsePower();
for (;;) {
final Token token = tokeniser.getToken();
final int sourceLocation = tokeniser.getStartPos();
if (token == Token.MUL || token == Token.DIV) {
- final Node powerNode = parsePower();
+ final TreeNode powerNode = parsePower();
termNode = handleBinaryArithmeticOp(token,
sourceLocation, termNode, powerNode);
}
else {
@@ -202,13 +203,13 @@
/**
* Implements power --> factor | factor ^ power
*/
- private Node parsePower() {
- Node powerNode = parseFactor();
+ private AbstractNode parsePower() {
+ AbstractNode powerNode = parseFactor();
final Token token = tokeniser.getToken();
final int sourceLocation = tokeniser.getStartPos();
if (token == Token.CARET) {
- final Node rhs = parsePower();
+ final TreeNode rhs = parsePower();
powerNode = handleBinaryArithmeticOp(token,
sourceLocation, powerNode, rhs);
}
else
@@ -220,7 +221,7 @@
/**
* Implements factor --> constant | variable_ref | "(" expr ")" |
("-"|"+") factor | func_call
*/
- private Node parseFactor() {
+ private AbstractNode parseFactor() {
Token token = tokeniser.getToken();
int sourceLocation = tokeniser.getStartPos();
@@ -288,7 +289,7 @@
// 3. a parenthesised expression
if (token == Token.OPEN_PAREN) {
- final Node exprNode = parseExpr();
+ final AbstractNode exprNode = parseExpr();
token = tokeniser.getToken();
if (token != Token.CLOSE_PAREN)
throw new IllegalStateException(sourceLocation
+ ": '(' expected!");
@@ -298,7 +299,7 @@
// 4. a unary operator
if (token == Token.PLUS || token == Token.MINUS) {
- final Node factor = parseFactor();
+ final TreeNode factor = parseFactor();
return handleUnaryOp(sourceLocation, token, factor);
}
@@ -314,7 +315,7 @@
throw new IllegalStateException(sourceLocation + ": unexpected
input token: " + token + "!");
}
- private Node handleUnaryOp(final int sourceLocation, final Token
operator, final Node operand) {
+ private AbstractNode handleUnaryOp(final int sourceLocation, final
Token operator, final TreeNode operand) {
final Class<?> operandType = operand.getType();
if (operandType == Boolean.class || operandType == String.class
|| FunctionUtil.isSomeKindOfList(operandType))
@@ -329,7 +330,7 @@
/**
* Implements func_call --> ident "(" ")" | ident "(" expr {"," expr}
")".
*/
- private Node parseFunctionCall() {
+ private AbstractNode parseFunctionCall() {
Token token = tokeniser.getToken();
final int functionNameStartPos = tokeniser.getStartPos();
if (token != Token.IDENTIFIER)
@@ -358,7 +359,7 @@
// Parse the comma-separated argument list.
final ArrayList<Class<?>> argTypes = new ArrayList<Class<?>>();
- ArrayList<Node> args = new ArrayList<Node>();
+ ArrayList<AbstractNode> args = new ArrayList<AbstractNode>();
int sourceLocation;
for (;;) {
token = tokeniser.getToken();
@@ -367,7 +368,7 @@
break;
tokeniser.ungetToken(token);
- final Node exprNode = parseExpr();
+ final AbstractNode exprNode = parseExpr();
argTypes.add(exprNode.getType());
args.add(exprNode);
@@ -386,7 +387,7 @@
throw new IllegalStateException(sourceLocation + ":
expected the closing parenthesis of a call to "
+ functionNameCandidate
+ "!");
- Node[] nodeArray = new Node[args.size()];
+ AbstractNode[] nodeArray = new AbstractNode[args.size()];
return new FuncCallNode(functionNameStartPos, func, returnType,
args.toArray(nodeArray));
}
@@ -394,7 +395,7 @@
/**
* Implements --> "DEFINED" "(" ident ")". If the opening brace is
found a closing brace is also required.
*/
- private Node parseDefined() {
+ private AbstractNode parseDefined() {
Token token = tokeniser.getToken();
final int definedStart = tokeniser.getStartPos();
if (token != Token.OPEN_PAREN)
@@ -442,7 +443,7 @@
/**
* Deals w/ any necessary type conversions for any binary arithmetic
operation on numbers.
*/
- private Node handleBinaryArithmeticOp(final Token operator, final int
sourceLocation, final Node lhs, final Node rhs) {
+ private AbstractNode handleBinaryArithmeticOp(final Token operator,
final int sourceLocation, final TreeNode lhs, final TreeNode rhs) {
// First operand is Double:
if (lhs.getType() == Double.class && rhs.getType() ==
Double.class)
return new BinOpNode(sourceLocation, operator, lhs,
rhs);
@@ -480,7 +481,7 @@
/**
* Deals w/ any necessary type conversions for any binary comparison
operation.
*/
- private Node handleComparisonOp(final Token operator, final int
sourceLocation, final Node lhs, final Node rhs) {
+ private AbstractNode handleComparisonOp(final Token operator, final int
sourceLocation, final TreeNode lhs, final TreeNode rhs) {
// First operand is Double:
if (lhs.getType() == Double.class && rhs.getType() ==
Double.class)
return new BinOpNode(sourceLocation, operator, lhs,
rhs);
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BinOpNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BinOpNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BinOpNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,7 +33,8 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.Token;
import org.cytoscape.equations.internal.interpreter.Instruction;
@@ -41,11 +42,11 @@
/**
* A node in the parse tree representing a binary operator.
*/
-public class BinOpNode extends Node {
+public class BinOpNode extends AbstractNode {
private final Token operator;
- private final Node lhs, rhs;
+ private final TreeNode lhs, rhs;
- public BinOpNode(final int sourceLocation, final Token operator, final
Node lhs, final Node rhs) {
+ public BinOpNode(final int sourceLocation, final Token operator, final
TreeNode lhs, final TreeNode rhs) {
super(sourceLocation);
if (lhs == null)
@@ -65,12 +66,12 @@
/**
* @return the left operand
*/
- public Node getLeftChild() { return lhs; }
+ public TreeNode getLeftChild() { return lhs; }
/**
* @return the right operand
*/
- public Node getRightChild() { return rhs; }
+ public TreeNode getRightChild() { return rhs; }
public Token getOperator() { return operator; }
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BooleanConstantNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BooleanConstantNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/BooleanConstantNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,13 +33,14 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
/**
* A node in the parse tree representing an integer constant.
*/
-public class BooleanConstantNode extends Node {
+public class BooleanConstantNode extends AbstractNode {
private final boolean value;
public BooleanConstantNode(final int sourceLocation, final boolean
value) {
@@ -55,12 +56,12 @@
/**
* @return null, This type of node never has any children!
*/
- public Node getLeftChild() { return null; }
+ public TreeNode getLeftChild() { return null; }
/**
* @return null, This type of node never has any children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public boolean getValue() { return value; }
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FConvNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FConvNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FConvNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,17 +33,18 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.interpreter.Instruction;
/**
* A node in the parse tree representing a conversion to a floating point
number
*/
-public class FConvNode extends Node {
- private final Node convertee;
+public class FConvNode extends AbstractNode {
+ private final TreeNode convertee;
- public FConvNode(final Node convertee) {
+ public FConvNode(final TreeNode convertee) {
super(-1); // Type conversions are generated by the compiler
and do not correspond to actual source locations!
if (convertee == null)
@@ -65,12 +66,12 @@
/**
* @return the only child of this node
*/
- public Node getLeftChild() { return convertee; }
+ public TreeNode getLeftChild() { return convertee; }
/**
* @return null, This type of node never has any right children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public void genCode(final Stack<CodeAndSourceLocation> codeStack) {
convertee.genCode(codeStack);
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FloatConstantNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FloatConstantNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FloatConstantNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,13 +33,14 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
/**
* A node in the parse tree representing an integer constant.
*/
-public class FloatConstantNode extends Node {
+public class FloatConstantNode extends AbstractNode {
private final double value;
public FloatConstantNode(final int sourceLocation, final double value) {
@@ -55,12 +56,12 @@
/**
* @return null, This type of node never has any children!
*/
- public Node getLeftChild() { return null; }
+ public TreeNode getLeftChild() { return null; }
/**
* @return null, This type of node never has any children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public double getValue() { return value; }
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FuncCallNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FuncCallNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/FuncCallNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -34,19 +34,20 @@
import org.cytoscape.equations.CodeAndSourceLocation;
import org.cytoscape.equations.Function;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.interpreter.Instruction;
/**
* A node in the parse tree representing a function call.
*/
-public class FuncCallNode extends Node {
+public class FuncCallNode extends AbstractNode {
private final Function func;
final Class returnType;
- private final Node[] args;
+ private final TreeNode[] args;
- public FuncCallNode(final int sourceLocation, final Function func,
final Class returnType, final Node[] args) {
+ public FuncCallNode(final int sourceLocation, final Function func,
final Class returnType, final TreeNode[] args) {
super(sourceLocation);
if (func == null)
@@ -68,12 +69,12 @@
/**
* @return null, This type of node never has any children!
*/
- public Node getLeftChild() { return null; }
+ public TreeNode getLeftChild() { return null; }
/**
* @return null, This type of node never has any children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
/**
* @return null, The return value for this node is only known at
runtime!
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/IdentNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/IdentNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/IdentNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,14 +33,15 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.interpreter.Instruction;
/**
* A node in the parse tree representing an attribute reference.
*/
-public class IdentNode extends Node {
+public class IdentNode extends AbstractNode {
private final String attribName;
private final Object defaultValue;
private final Class type;
@@ -66,12 +67,12 @@
/**
* @return null, This type of node never has any children!
*/
- public Node getLeftChild() { return null; }
+ public TreeNode getLeftChild() { return null; }
/**
* @return null, This type of node never has any children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public String getAttribName() { return attribName; }
public Object getDefaultValue() { return defaultValue; }
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/SConvNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/SConvNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/SConvNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,17 +33,18 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.interpreter.Instruction;
/**
* A node in the parse tree representing an conversion to a string
*/
-public class SConvNode extends Node {
- private final Node convertee;
+public class SConvNode extends AbstractNode {
+ private final TreeNode convertee;
- public SConvNode(final Node convertee) {
+ public SConvNode(final TreeNode convertee) {
super(-1); // Type conversions are generated by the compiler
and do not correspond to actual source locations!
if (convertee == null)
@@ -65,12 +66,12 @@
/**
* @return the only child of this node
*/
- public Node getLeftChild() { return convertee; }
+ public TreeNode getLeftChild() { return convertee; }
/**
* @return null, This type of node never has any right children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public void genCode(final Stack<CodeAndSourceLocation> codeStack) {
convertee.genCode(codeStack);
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/StringConstantNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/StringConstantNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/StringConstantNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,13 +33,14 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
/**
* A node in the parse tree representing an integer constant.
*/
-public class StringConstantNode extends Node {
+public class StringConstantNode extends AbstractNode {
private final String value;
public StringConstantNode(final int sourceLocation, final String value)
{
@@ -55,12 +56,12 @@
/**
* @return null, This type of node never has any children!
*/
- public Node getLeftChild() { return null; }
+ public TreeNode getLeftChild() { return null; }
/**
* @return null, This type of node never has any children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public String getValue() { return value; }
Modified:
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/UnaryOpNode.java
===================================================================
---
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/UnaryOpNode.java
2011-11-24 00:47:09 UTC (rev 27597)
+++
core3/impl/trunk/equations-impl/src/main/java/org/cytoscape/equations/internal/parse_tree/UnaryOpNode.java
2011-11-24 00:54:00 UTC (rev 27598)
@@ -33,7 +33,8 @@
import java.util.Stack;
import org.cytoscape.equations.CodeAndSourceLocation;
-import org.cytoscape.equations.Node;
+import org.cytoscape.equations.AbstractNode;
+import org.cytoscape.equations.TreeNode;
import org.cytoscape.equations.internal.Token;
import org.cytoscape.equations.internal.interpreter.Instruction;
@@ -41,11 +42,11 @@
/**
* A node in the parse tree representing a unary operator application.
*/
-public class UnaryOpNode extends Node {
+public class UnaryOpNode extends AbstractNode {
private final Token operator;
- private final Node operand;
+ private final TreeNode operand;
- public UnaryOpNode(final int sourceLocation, final Token operator,
final Node operand) {
+ public UnaryOpNode(final int sourceLocation, final Token operator,
final TreeNode operand) {
super(sourceLocation);
if (operand == null)
@@ -62,12 +63,12 @@
/**
* @return the operand
*/
- public Node getLeftChild() { return operand; }
+ public TreeNode getLeftChild() { return operand; }
/**
* @return null, This type of node never has any left children!
*/
- public Node getRightChild() { return null; }
+ public TreeNode getRightChild() { return null; }
public Token getOperator() { return operator; }
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.