Author: bugman Date: Mon Apr 21 23:40:57 2008 New Revision: 5943 URL: http://svn.gna.org/viewcvs/relax?rev=5943&view=rev Log: Wrote the Element.is_empty() method. Modified: 1.3/data/data_classes.py Modified: 1.3/data/data_classes.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/data_classes.py?rev=5943&r1=5942&r2=5943&view=diff ============================================================================== --- 1.3/data/data_classes.py (original) +++ 1.3/data/data_classes.py Mon Apr 21 23:40:57 2008 @@ -44,6 +44,30 @@ # Return the lot. return text + + + def is_empty(self): + """Method for testing if the Element container is empty. + + @return: True if the Element container is empty, False otherwise. + @rtype: bool + """ + + # An object has been added to the container. + for name in dir(self): + # Skip the Element methods. + if name == 'is_empty': + continue + + # Skip special objects. + if match("^__", name): + continue + + # An object has been added. + return False + + # The Element container is empty. + return True