00001 #ifndef _STREE_VARIABLE_ 00002 #define _STREE_VARIABLE_ 00003 00004 #include "streenode.h" 00005 #include "streeconstant.h" 00006 00007 00008 #define CVariable "Variable" 00009 00011 class Variable : public Node 00012 { 00014 int id; 00015 public: 00017 int getId() const { return id; }; 00018 00020 Variable(int iid); 00021 00023 Variable(Constant *name); 00024 00026 Variable(const string &name); 00027 00028 virtual SType getType() const { return SVariable; }; 00029 00030 virtual string getName() const { return CVariable; }; 00031 00032 virtual ostream& print(ostream &os) const; 00033 00034 virtual ostream& php(ostream &os) const; 00035 00036 virtual bool match(const Node *p, Assignment &assign, const NameSpace &nameSpace) const; 00037 00038 virtual bool matchToBegining(const List *p, Assignment &assign, const NameSpace &nameSpace) const; 00039 00040 virtual bool compare(const Node *p) const; 00041 00042 virtual Node* copy() const; 00043 00044 virtual void getVariables(VariableList &vlist) const; 00045 00046 virtual string evaluate(const NameSpace &nameSpace) const; 00047 00048 protected: 00049 00050 virtual Node* substitute(const Assignment &assign); 00051 }; 00052 00053 #endif