CogPar
A versatile parser for mathematical expressions.
 All Classes Functions Variables
Public Member Functions | Static Public Attributes | List of all members
uk.co.cogitolearning.cogpar.ExpressionNode Interface Reference

An interface for expression nodes. More...

Inheritance diagram for uk.co.cogitolearning.cogpar.ExpressionNode:
Inheritance graph
[legend]

Public Member Functions

int getType ()
 Returns the type of the node.ExpressionNode.
double getValue ()
 Calculates and returns the value of the sub-expression represented by the node.
void accept (ExpressionNodeVisitor visitor)
 Method needed for the visitor design pattern.

Static Public Attributes

static final int VARIABLE_NODE = 1
 Node id for variable nodes.
static final int CONSTANT_NODE = 2
 Node id for constant nodes.
static final int ADDITION_NODE = 3
 Node id for addition nodes.
static final int MULTIPLICATION_NODE = 4
 Node id for multiplication nodes.
static final int EXPONENTIATION_NODE = 5
 Node id for exponentiation nodes.
static final int FUNCTION_NODE = 6
 Node id for function nodes.

Detailed Description

An interface for expression nodes.

Every concrete type of expression node has to implement this interface.

Definition at line 32 of file ExpressionNode.java.

Member Function Documentation

void uk.co.cogitolearning.cogpar.ExpressionNode.accept ( ExpressionNodeVisitor  visitor)
int uk.co.cogitolearning.cogpar.ExpressionNode.getType ( )

Returns the type of the node.ExpressionNode.

Each class derived from ExpressionNode representing a specific role in the expression should return the type according to that role.

Returns
type of the node

Implemented in uk.co.cogitolearning.cogpar.FunctionExpressionNode, uk.co.cogitolearning.cogpar.ConstantExpressionNode, uk.co.cogitolearning.cogpar.VariableExpressionNode, uk.co.cogitolearning.cogpar.AdditionExpressionNode, uk.co.cogitolearning.cogpar.MultiplicationExpressionNode, and uk.co.cogitolearning.cogpar.ExponentiationExpressionNode.

double uk.co.cogitolearning.cogpar.ExpressionNode.getValue ( )

The documentation for this interface was generated from the following file: