-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmemento.py
37 lines (28 loc) · 976 Bytes
/
memento.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python
class Memento(object):
"""
This class defines the Memento objects and contains all necessary data to recreate a previous condition.
"""
_object = None
def __init__(self):
""" Constructor of Memento and default values will be initialised. """
# call constructor of parent class
super(Memento, self).__init__()
self._object = None
def __init__(self, state = None):
""" Constructor of Memento and the defined status will be stored. """
# call constructor of parent class
super(Memento, self).__init__()
# set the state of the memento
if state != None:
self._object = state
else:
self._object = None
@property
def state(self):
""" Return state of the memento. """
return self._object
@state.setter
def state(self, state):
""" Set state of the memento. """
self._object = state