Author: bugman Date: Mon Apr 14 16:13:26 2008 New Revision: 5688 URL: http://svn.gna.org/viewcvs/relax?rev=5688&view=rev Log: Renamed Selection.match() to Selection.wildcard_match() Modified: 1.3/generic_fns/selection.py Modified: 1.3/generic_fns/selection.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/selection.py?rev=5688&r1=5687&r2=5688&view=diff ============================================================================== --- 1.3/generic_fns/selection.py (original) +++ 1.3/generic_fns/selection.py Mon Apr 14 16:13:26 2008 @@ -124,21 +124,21 @@ elif isinstance(obj, MoleculeContainer): if not self.molecules: return True - elif self.match(obj.name, self.molecules): + elif self.wildcard_match(obj.name, self.molecules): return True # The object is a residue. elif isinstance(obj, ResidueContainer): if not self.residues: return True - elif self.match(obj.name, self.residues) or obj.num in self.residues: + elif self.wildcard_match(obj.name, self.residues) or obj.num in self.residues: return True # The object is a spin. elif isinstance(obj, SpinContainer): if not self.spins: return True - elif self.match(obj.name, self.spins) or obj.num in self.spins: + elif self.wildcard_match(obj.name, self.spins) or obj.num in self.spins: return True # No match. @@ -158,8 +158,23 @@ self._intersect = (select_obj0, select_obj1) - def match(self, string, patterns): + def union(self, select_obj0, select_obj1): + """Make a Selection object the union of two Selection objects + + @type select_obj0: Instance of class Selection + @param select_obj0: First Selection object in union + @type select_obj1: Instance of class Selection + @param select_obj1: First Selection object in union""" + + if self._union or self._intersect or self.molecules or self.residues or self.spins: + raise RelaxError, "Cannot define multiple Boolean relationships between Selection objects" + self._union = (select_obj0, select_obj1) + + + def wildcard_match(self, string, patterns): """Determine if the string is in the list of patterns, allowing for regular expressions. + + This method converts from relax's RE syntax to that of the re python module. @param string: The molecule/res/spin name or number. @type string: str @@ -186,18 +201,6 @@ # No matches. return False - - def union(self, select_obj0, select_obj1): - """Make a Selection object the union of two Selection objects - - @type select_obj0: Instance of class Selection - @param select_obj0: First Selection object in union - @type select_obj1: Instance of class Selection - @param select_obj1: First Selection object in union""" - - if self._union or self._intersect or self.molecules or self.residues or self.spins: - raise RelaxError, "Cannot define multiple Boolean relationships between Selection objects" - self._union = (select_obj0, select_obj1) def count_selected_spins(selection=None):