00001 #include <typeinfo> 00002 #include "simpleaction.h" 00003 using namespace std; 00004 00005 Ast& SimpleAction::operator = (const Ast& ast) { 00006 const SimpleAction& simpleAction = dynamic_cast<const SimpleAction&>(ast); 00007 00008 Action::operator=(ast); 00009 this->guard = simpleAction.guard ? dynamic_cast<Guard*>(&(simpleAction.guard->clone())) : 0; 00010 this->statement = simpleAction.statement ? dynamic_cast<Statement*>(&(simpleAction.statement->clone())) : 0; 00011 00012 return *(this); 00013 } 00014 00015 bool SimpleAction::operator == (const Ast& ast) const { 00016 bool result = false; 00017 const SimpleAction& simpleAction = dynamic_cast<const SimpleAction&>(ast); 00018 00019 if (typeid(ast) != typeid(SimpleAction)) 00020 return false; 00021 00022 if (this->guard && this->statement) 00023 result = (*(this->guard) == *(simpleAction.guard) && 00024 *(this->statement) == *(simpleAction.statement)); 00025 00026 return result && Action::operator==(ast); 00027 } 00028