mailr3168 - in /1.3/data: mol_res_spin.py pipe_container.py prototype.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 13, 2007 - 04:48:
Author: bugman
Date: Tue Mar 13 04:47:39 2007
New Revision: 3168

URL: http://svn.gna.org/viewcvs/relax?rev=3168&view=rev
Log:
Created a prototype design pattern as a base class with the __copy__() method.

The prototype __copy__() method simply returns a deepcopy of the object.  The 
PipeContainer,
SpinContainer, ResidueContainer, and MoleculeContainer classes now inherit 
from the prototype class.

Added:
    1.3/data/prototype.py
Modified:
    1.3/data/mol_res_spin.py
    1.3/data/pipe_container.py

Modified: 1.3/data/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/mol_res_spin.py?rev=3168&r1=3167&r2=3168&view=diff
==============================================================================
--- 1.3/data/mol_res_spin.py (original)
+++ 1.3/data/mol_res_spin.py Tue Mar 13 04:47:39 2007
@@ -21,19 +21,22 @@
 
###############################################################################
 
 # Python module imports.
+from copy import deepcopy
 from re import match
 from types import DictType, ListType
 
+# relax module imports.
+from prototype import Prototype
+
 
 """The molecule-residue-spin containers."""
-
 
 
 
 # The spin system data.
 #######################
 
-class SpinContainer:
+class SpinContainer(Prototype):
     """Class containing all the spin system specific data."""
 
     def __init__(self, spin_name=None, spin_num=None, select=1):
@@ -112,7 +115,7 @@
 # The residue data.
 ###################
 
-class ResidueContainer:
+class ResidueContainer(Prototype):
     """Class containing all the residue specific data."""
 
     def __init__(self, res_name=None, res_num=None):
@@ -193,7 +196,7 @@
 # The molecule data.
 ###################
 
-class MoleculeContainer:
+class MoleculeContainer(Prototype):
     """Class containing all the molecule specific data."""
 
     def __init__(self, mol_name=None):

Modified: 1.3/data/pipe_container.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/pipe_container.py?rev=3168&r1=3167&r2=3168&view=diff
==============================================================================
--- 1.3/data/pipe_container.py (original)
+++ 1.3/data/pipe_container.py Tue Mar 13 04:47:39 2007
@@ -25,12 +25,13 @@
 
 # relax module imports.
 from data_classes import SpecificData
+from diff_tensor import DiffTensorData
 from mol_res_spin import MoleculeList
-from diff_tensor import DiffTensorData
+from prototype import Prototype
 
 
 
-class PipeContainer:
+class PipeContainer(Prototype):
     """Class containing all the program data."""
 
     # Molecular structure data.

Added: 1.3/data/prototype.py
URL: http://svn.gna.org/viewcvs/relax/1.3/data/prototype.py?rev=3168&view=auto
==============================================================================
--- 1.3/data/prototype.py (added)
+++ 1.3/data/prototype.py Tue Mar 13 04:47:39 2007
@@ -1,0 +1,36 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2007 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax.                                    
 #
+#                                                                            
 #
+# relax 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.                                        
 #
+#                                                                            
 #
+# relax 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 relax; if not, write to the Free Software                       
 #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
+#                                                                            
 #
+###############################################################################
+
+# Python module imports.
+from copy import deepcopy
+
+
+"""The molecule-residue-spin containers."""
+
+
+class Prototype:
+    """Base class implementing the prototype design pattern."""
+
+    def __copy__(self):
+        """Prototype method which returns a deepcopy of the object."""
+
+        return deepcopy(self)




Related Messages


Powered by MHonArc, Updated Tue Mar 13 05:00:08 2007