Author: bugman Date: Mon Apr 14 22:17:11 2008 New Revision: 5719 URL: http://svn.gna.org/viewcvs/relax?rev=5719&view=rev Log: The Selection.__contains__() method now is complete and all the relevant unit tests pass again. Modified: branches/spin_loop_bool/generic_fns/selection.py Modified: branches/spin_loop_bool/generic_fns/selection.py URL: http://svn.gna.org/viewcvs/relax/branches/spin_loop_bool/generic_fns/selection.py?rev=5719&r1=5718&r2=5719&view=diff ============================================================================== --- branches/spin_loop_bool/generic_fns/selection.py (original) +++ branches/spin_loop_bool/generic_fns/selection.py Mon Apr 14 22:17:11 2008 @@ -171,26 +171,44 @@ # Molecule container. if mol: + # No molecules in selection object, therefore default to a match. if not self.molecules: select_mol = True + + # A true match. elif wildcard_match(mol.name, self.molecules): select_mol = True + else: + # No molecule container sent in, therefore the molecule is assumed to match. + select_mol = True # Residue container. if res: + # No residues in selection object, therefore default to a match. if not self.residues: select_res = True + + # A true match. elif wildcard_match(res.name, self.residues) or res.num in self.residues: select_res = True + else: + # No residue container sent in, therefore the residue is assumed to match. + select_res = True # Spin container. if spin: + # No spins in selection object, therefore default to a match. if not self.spins: select_spin = True + + # A true match. elif wildcard_match(spin.name, self.spins) or spin.num in self.spins: select_spin = True - - # Return the selection flag. + else: + # No spin container sent in, therefore the spin is assumed to match. + select_spin = True + + # Return the selection status. return select_mol and select_res and select_spin