00001 #include "streenamedlist.h" 00002 00003 NamedList::NamedList(string name) : List(name){}; 00004 NamedList::NamedList(string name,Node *statement) : List(name){ 00005 push_back(statement); 00006 }; 00007 00008 Nullary::Nullary(string name) : List(name){}; 00009 00010 ostream& Nullary::php(ostream &os) const{ 00011 os << getName(); 00012 return os; 00013 }; 00014 00015 Node* Nullary::copy() const{ 00016 return new Nullary(getName()); 00017 }; 00018 00019 Unary::Unary(string name,Node* statement) : List(name){ 00020 push_back(statement); 00021 }; 00022 00023 Node* Unary::getStatement1() { 00024 return *begin(); 00025 }; 00026 00027 const Node* Unary::getStatement1() const{ 00028 return *begin(); 00029 }; 00030 00031 00032 ostream& Unary::php(ostream &os) const{ 00033 os << getName() << " " << getStatement1(); 00034 return os; 00035 }; 00036 00037 Node* Unary::copy() const{ 00038 return new Unary(getName(),getStatement1()->copy()); 00039 }; 00040 00041 00042 00043 Binary::Binary(string name,Node* statement1, Node* statement2) : List(name){ 00044 push_back(statement1); 00045 push_back(statement2); 00046 }; 00047 00048 Node* Binary::getStatement1() { 00049 return *begin(); 00050 }; 00051 00052 Node* Binary::getStatement2() { 00053 return *(++begin()); 00054 }; 00055 00056 const Node* Binary::getStatement1() const{ return *begin(); }; 00057 const Node* Binary::getStatement2() const{ return *(++begin()); }; 00058 00059 ostream& Binary::php(ostream &os) const{ 00060 os << getName() << " " << getStatement1() << " " << getStatement2(); 00061 return os; 00062 }; 00063 00064 Node* Binary::copy() const{ 00065 return new Binary(getName(),getStatement1()->copy(),getStatement2()->copy()); 00066 }; 00067 00068 Ternary::Ternary(string name,Node* statement1, Node* statement2, Node* statement3) 00069 : List(name){ 00070 push_back(statement1); 00071 push_back(statement2); 00072 push_back(statement3); 00073 }; 00074 00075 Node* Ternary::getStatement1() { return *begin(); }; 00076 Node* Ternary::getStatement2() { return *(++begin()); }; 00077 Node* Ternary::getStatement3() { return *(++++begin()); }; 00078 00079 const Node* Ternary::getStatement1() const{ return *begin(); }; 00080 const Node* Ternary::getStatement2() const{ return *(++begin()); }; 00081 const Node* Ternary::getStatement3() const{ return *(++++begin()); }; 00082 00083 ostream& Ternary::php(ostream &os) const{ 00084 os << getName() << " " << getStatement1() << " " << getStatement2() << " " << getStatement3(); 00085 return os; 00086 }; 00087 00088 Node* Ternary::copy() const{ 00089 return new Ternary(getName(),getStatement1()->copy(),getStatement2()->copy(),getStatement3()->copy()); 00090 }; 00091 00092 Quadary::Quadary(string name,Node* statement1, Node* statement2, Node* statement3, Node* statement4) 00093 : List(name){ 00094 push_back(statement1); 00095 push_back(statement2); 00096 push_back(statement3); 00097 push_back(statement4); 00098 }; 00099 00100 Node* Quadary::getStatement1() { return *begin(); }; 00101 Node* Quadary::getStatement2() { return *(++begin()); }; 00102 Node* Quadary::getStatement3() { return *(++++begin()); }; 00103 Node* Quadary::getStatement4() { return *(++++++begin()); }; 00104 00105 const Node* Quadary::getStatement1() const{ return *begin(); }; 00106 const Node* Quadary::getStatement2() const{ return *(++begin()); }; 00107 const Node* Quadary::getStatement3() const{ return *(++++begin()); }; 00108 const Node* Quadary::getStatement4() const{ return *(++++++begin()); }; 00109 00110 ostream& Quadary::php(ostream &os) const{ 00111 os << getName() << " " << getStatement1() << " " 00112 << getStatement2() << " " << getStatement3() 00113 << " " << getStatement4(); 00114 return os; 00115 }; 00116 00117 Node* Quadary::copy() const{ 00118 return new Quadary(getName(),getStatement1()->copy(),getStatement2()->copy(),getStatement3()->copy(),getStatement4()->copy()); 00119 };