net.scheinerman.phoenix.interpreter.parser.operators
Class FunctionOperatorNode

java.lang.Object
  extended by net.scheinerman.phoenix.interpreter.parser.operators.OperatorNode
      extended by net.scheinerman.phoenix.interpreter.parser.operators.FunctionOperatorNode
All Implemented Interfaces:
ParserTreeNode

public class FunctionOperatorNode
extends OperatorNode

Provides the implementation of the Function operator in the parsing tree when parsing expressions.

Since:
1.5
Version:
1.0
Author:
Jonah Scheinerman

Field Summary
private  Variable[] af
           
private  Variable[] b4
           
private  Function function
           
 
Constructor Summary
FunctionOperatorNode(Function function, ParserTreeNode left, ParserTreeNode right)
           
 
Method Summary
 Function getFunction()
           
 int getPrecedence()
          Returns the precedence of the node in the order of operations, when it should be evaluated in the tree.
 boolean isLeftOperandUnary()
          Determines if, for a unary operator the operand is on the right or the left.
 boolean isUnary()
          Returns whether or not this operator is unary, meaning that it only accepts one operand on the right or the left.
 Variable operate()
          Parses this operator, by operating on the left and right hand arguments and then combining the results in some implementation specific manner.
 java.lang.String operator()
          Returns the string representation of this operator.
 java.lang.String toString()
          Returns a string in the form: "(" + left().toString() + operator() + right().toString() + ")".
 
Methods inherited from class net.scheinerman.phoenix.interpreter.parser.operators.OperatorNode
isParenthesized, left, left, right, right, setParenthesized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

function

private Function function

b4

private Variable[] b4

af

private Variable[] af
Constructor Detail

FunctionOperatorNode

public FunctionOperatorNode(Function function,
                            ParserTreeNode left,
                            ParserTreeNode right)
Method Detail

operate

public Variable operate()
Description copied from class: OperatorNode
Parses this operator, by operating on the left and right hand arguments and then combining the results in some implementation specific manner.

Specified by:
operate in interface ParserTreeNode
Overrides:
operate in class OperatorNode
Returns:
The variable result of the operation.

operator

public java.lang.String operator()
Description copied from class: OperatorNode
Returns the string representation of this operator. For example, in the case of the add operator, the string "+" is returned.

Specified by:
operator in class OperatorNode
Returns:
A string representation of this operator symbol.

getFunction

public Function getFunction()

getPrecedence

public int getPrecedence()
Description copied from interface: ParserTreeNode
Returns the precedence of the node in the order of operations, when it should be evaluated in the tree. The precedence is an integer, the higher the integer, the higher the precedence, meaning that this node will be evaluated sooner than those of lower precedence.

Specified by:
getPrecedence in interface ParserTreeNode
Specified by:
getPrecedence in class OperatorNode
Returns:
A number representing the precedence of this node.

isUnary

public boolean isUnary()
Description copied from class: OperatorNode
Returns whether or not this operator is unary, meaning that it only accepts one operand on the right or the left. To specify what operand it takes, the isLeftOperandUnary() method is used. By default, this method returns false.

Overrides:
isUnary in class OperatorNode
Returns:
true if it is unary, false if not.

isLeftOperandUnary

public boolean isLeftOperandUnary()
Description copied from class: OperatorNode
Determines if, for a unary operator the operand is on the right or the left. If this method returns true, then the operator has a left-hand operand, if false, the operator has a right-hand operand.

Overrides:
isLeftOperandUnary in class OperatorNode
Returns:
true if this operator has a left-hand, false if it has a right-hand operand.

toString

public java.lang.String toString()
Description copied from class: OperatorNode
Returns a string in the form: "(" + left().toString() + operator() + right().toString() + ")".

Overrides:
toString in class OperatorNode
Returns:
A string form of this section of the parsing tree.