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