# Copyright (c) 2000-2001 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

"""MemoryListener module.

Defines the MemoryListenerInterface and two trivial implementations.
"""

__revision__ = "$Id: MemoryListener.py,v 1.9 2001/11/19 16:14:18 syt Exp $"

class MemoryListenerInterface:
    """MemoryListener interface"""

    def addElement(self,elementId):
        raise NameError("method not implemented in implementing class")

    def removeElement(self,elementId):
        raise NameError("method not implemented in implementing class")

    def replaceElement(self,elementId):
        raise NameError("method not implemented in implementing class")


class MemoryListenerImplementation(MemoryListenerInterface):
    """MemoryListener implementation (pass on everything)"""

    def addElement(self,elementId):
        pass
    
    def removeElement(self,elementId):
        pass

    def replaceElement(self,elementId):
        pass

    
class MemoryListenerPrintImplementation(MemoryListenerInterface):
    """MemoryListener implementation (print everything)"""

    def addElement(self,elementId):
        print "Added element %s to memory" % (elementId)        

    def removeElement(self,elementId):
        print "Removed element %s from memory" % (elementId)

    def replaceElement(self,elementId):
        print 'Replaced element %s in memory'% (elementId)


