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