Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

Variable Class Reference

A Variable -- can be matched to other nodes. More...

#include <streevariable.h>

Inheritance diagram for Variable:

Node

Public Member Functions

int getId () const
 Returns the identifier of the variable.

 Variable (int iid)
 Creates Varable with given identifier.

 Variable (Constant *name)
 Creates Variable from constant by converting constant to int Constant::toInt.

 Variable (const string &name)
 Creates Variable from strnig by converting string to int.

virtual SType getType () const
 Returns type of the node.

virtual string getName () const
 Returs string representing node type or name for List.

virtual ostream & print (ostream &os) const
 Writes node to the stream.

virtual ostream & php (ostream &os) const
 Writes node to the stream as php.

virtual bool match (const Node *p, Assignment &assign, const NameSpace &nameSpace) const
 Matches node p to the node. If node matches sets the assignment.

virtual bool matchToBegining (const List *p, Assignment &assign, const NameSpace &nameSpace) const
 Matches the list to the begining of p.

virtual bool compare (const Node *p) const
 Comares node p to the node.

virtual Nodecopy () const
 Copies the node.

virtual void getVariables (VariableList &vlist) const
 Returns list of variables used in the node.

virtual string evaluate (const NameSpace &nameSpace) const
 Computes the value of the expression (only basic atihmetic and string operations).


Protected Member Functions

virtual Nodesubstitute (const Assignment &assign)
 Substitutes variables in the node accordingly to the given assignment.


Private Attributes

int id
 Identifier of the variable.


Detailed Description

A Variable -- can be matched to other nodes.

Definition at line 11 of file streevariable.h.


Constructor & Destructor Documentation

Variable::Variable int  iid  ) 
 

Creates Varable with given identifier.

Definition at line 4 of file streevariable.cpp.

Referenced by copy().

Variable::Variable Constant name  ) 
 

Creates Variable from constant by converting constant to int Constant::toInt.

Definition at line 6 of file streevariable.cpp.

Variable::Variable const string &  name  ) 
 

Creates Variable from strnig by converting string to int.

Definition at line 10 of file streevariable.cpp.

References id.


Member Function Documentation

bool Variable::compare const Node p  )  const [virtual]
 

Comares node p to the node.

Implements Node.

Definition at line 40 of file streevariable.cpp.

References getId(), Node::getType(), and SVariable.

Node * Variable::copy  )  const [virtual]
 

Copies the node.

Implements Node.

Definition at line 53 of file streevariable.cpp.

References getId(), and Variable().

Referenced by MultiContextRule::copy(), and NamedContextRule::execute().

string Variable::evaluate const NameSpace nameSpace  )  const [virtual]
 

Computes the value of the expression (only basic atihmetic and string operations).

Implements Node.

Definition at line 61 of file streevariable.cpp.

int Variable::getId  )  const [inline]
 

Returns the identifier of the variable.

Definition at line 17 of file streevariable.h.

References id.

Referenced by compare(), copy(), NamedContextRule::execute(), MultiContextRule::generateSubcontext(), getVariables(), match(), matchToBegining(), and substitute().

virtual string Variable::getName  )  const [inline, virtual]
 

Returs string representing node type or name for List.

Implements Node.

Definition at line 30 of file streevariable.h.

References CVariable.

virtual SType Variable::getType  )  const [inline, virtual]
 

Returns type of the node.

Implements Node.

Definition at line 28 of file streevariable.h.

References SType, and SVariable.

void Variable::getVariables VariableList vlist  )  const [virtual]
 

Returns list of variables used in the node.

Implements Node.

Definition at line 57 of file streevariable.cpp.

References getId().

bool Variable::match const Node p,
Assignment &  assign,
const NameSpace nameSpace
const [virtual]
 

Matches node p to the node. If node matches sets the assignment.

Implements Node.

Definition at line 25 of file streevariable.cpp.

References Node::copy(), and getId().

bool Variable::matchToBegining const List p,
Assignment &  assign,
const NameSpace nameSpace
const [virtual]
 

Matches the list to the begining of p.

Implements Node.

Definition at line 33 of file streevariable.cpp.

References List::copy(), and getId().

ostream & Variable::php ostream &  os  )  const [virtual]
 

Writes node to the stream as php.

Implements Node.

Definition at line 19 of file streevariable.cpp.

References id.

ostream & Variable::print ostream &  os  )  const [virtual]
 

Writes node to the stream.

Implements Node.

Definition at line 15 of file streevariable.cpp.

References id.

Node * Variable::substitute const Assignment &  assign  )  [protected, virtual]
 

Substitutes variables in the node accordingly to the given assignment.

Implements Node.

Definition at line 46 of file streevariable.cpp.

References Node::copy(), and getId().


Field Documentation

int Variable::id [private]
 

Identifier of the variable.

Definition at line 14 of file streevariable.h.

Referenced by getId(), php(), print(), and Variable().


The documentation for this class was generated from the following files:
Generated on Fri Nov 21 17:54:10 2003 for PHPX by doxygen 1.3.3