extends Node as public
The operator class, a Node subclass, is a generalized Node extended
to perform operations on other nodes.
The operator class, unlike the Node class, is able to modify nodes
other than itself. The operator class behaves in most ways
identically to the Node class (its parent class) but may also
"Make" itself from a stack of other Nodes. The definition of "Make"
varies from class to class but the resulting node must always be
able to evaluate itself after the Make process has been
completed. Operators have two additional responsibilities as well:
they must return a precedence (to tell the parser the proper order
of operators) and a description (usually corresponding to the
algebraic representation of the operator).
- Source:
- node.hh:95
- Author:
- Jonathan Kitchens
- Version:
- v0.9
| Entity | Inherited From | Type | Scope | Short Description |
| ~Operator | | destructor | public | automatically generated |
| Operator | | constructor | public | automatically generated |
| Operator | | constructor | public | automatically generated |
| Copy | | method | public | Same function as in the Node superclass; see Node for details.
|
| Evaluate | | method | public | Same function as in the Node superclass; see Node for details.
|
| GetDescription | | method | public | Returns the algebraic form/description of the operator.
|
| GetPrecedence | | method | public | Gives the precedence of this operator.
|
| Make | | method | public | Attempts to Make this operator from a stack of nodes.
|
| operator = | | operator | public | automatically generated |
| Print | | method | public | Same function as in the Node superclass; see Node for details.
|
destructor ~Operator | ? ^
> |
automatically generated
- Source:
- node.hh
- Code:
-
constructor Operator | ? ^
< > |
automatically generated
- Source:
- node.hh
- Code:
-
constructor Operator | ? ^
< > |
automatically generated
- Source:
- node.hh
- Code:
| public Operator ( | const Operator & ) |
Same function as in the Node superclass; see Node for details.
- Source:
- node.hh:122
- Author:
- Jonathan Kitchens
- Version:
- v0.9
- See Also:
- Node
- Code:
| public virtual Node * Copy ( | ) = 0 |
Same function as in the Node superclass; see Node for details.
- Source:
- node.hh:104
- Author:
- Jonathan Kitchens
- Version:
- v0.9
- See Also:
- Node
- Code:
| public virtual Number * Evaluate ( | ) = 0 |
method GetDescription | ? ^
< > |
Returns the algebraic form/description of the operator.
This function returns a string describing the function
of the operator. In general, this string will be used later
to recognize the operator in a parse stream, so it should
be the same as the algebraic representation of the operator
(ie, the description for a Plus operator should be
"+"). See the ParseType for an example of how this
description is used to find operators in a stream.
- Source:
- node.hh:141
- Author:
- Jonathan Kitchens
- Version:
- v0.9
- Returns:
- a string describing the function of the operator
- See Also:
- ParseType, ParseOps
- Code:
| public virtual string GetDescription ( | ) const = 0 |
method GetPrecedence | ? ^
< > |
Gives the precedence of this operator.
This function returns the precedence (relative importance)
of the operator. This will help the ParseType use the
correct order of operations in "Make"ing the operators in
the input string. The precedence is a double here because
this allows for a nearly infinite number of operators with a
unique order. Thus, inserting a new operator with a
precedence between that of two others can always be
accomplished without needing to change every operator's precedence.
- Source:
- node.hh:161
- Author:
- Jonathan Kitchens
- Version:
- v0.9
- Returns:
- a double containing the precedence of this operator
- See Also:
- ParseType, ParseOps
- Code:
| public virtual double GetPrecedence ( | ) const = 0 |
Attempts to Make this operator from a stack of nodes.
The Make function allows the operator creation and
processing to be done seperately. Each operator is free to
modify the stack as it wishes (the definition of an
operator), allowing postfix, prefix, unary, binary,
multi-argument, indefinite-argument, and many other types
of operators to be implemented easily. The only requirement
on the Make() function is that, afterwards, the Operator
Node should be able to be evaluated. The Make function has
the option to return true or false to report whether or not
the operator was able to initialize.
- Source:
- node.hh:186
- Author:
- Jonathan Kitchens
- Version:
- v0.9
- Param:
| myNodeStack
| a stack of Nodes which the operator may
modify at will
|
- Returns:
- true if the operator is ready to be evaluated,
false otherwise
- See Also:
- ParseOps, Parser
- Code:
| public virtual bool Make ( | stack < Node * > & myNodeStack ) = 0 |
automatically generated
- Source:
- node.hh
- Code:
| public Operator & operator = ( | const Operator & ) |
Same function as in the Node superclass; see Node for details.
- Source:
- node.hh:113
- Author:
- Jonathan Kitchens
- Version:
- v0.9
- See Also:
- Node
- Code:
| public virtual void Print ( | ostream & out ) const = 0 |
Created Sun Oct 6 21:22:17 2002.
This documentation was generated automatically by
ccdoc v0.8 r26 2001/11/28 bin_opt_suncc_solaris-2.8.
Click here to submit a bug report or feature request.
Click here to return to the top of the page.