mailr9768 - /branches/bmrb/data/exp_info.py


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

Header


Content

Posted by edward on October 14, 2009 - 15:27:
Author: bugman
Date: Wed Oct 14 15:27:17 2009
New Revision: 9768

URL: http://svn.gna.org/viewcvs/relax?rev=9768&view=rev
Log:
Added the get_cite_id_num() method to convert the citation ID string to a 
citation ID number.


Modified:
    branches/bmrb/data/exp_info.py

Modified: branches/bmrb/data/exp_info.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/data/exp_info.py?rev=9768&r1=9767&r2=9768&view=diff
==============================================================================
--- branches/bmrb/data/exp_info.py (original)
+++ branches/bmrb/data/exp_info.py Wed Oct 14 15:27:17 2009
@@ -76,8 +76,6 @@
         @type page_last:            int
         @keyword year:              The publication year.
         @type year:                 int
-        @return:                    The citation ID number.
-        @rtype:                     int
         """
 
         # Initialise the list container if needed.
@@ -120,8 +118,21 @@
         # Append the container.
         self.citations.append(cite)
 
-        # Return the citation ID.
-        return len(self.citations)
+
+    def get_cite_id_num(self, cite_id):
+        """Return the citation ID number for the given citation ID string.
+
+        @param cite_id: The citation ID string.
+        @type cite_id:  str
+        @return:        The citation ID number.
+        @rtype:         int
+        """
+
+        # Loop over the citations.
+        for i in range(len(self.citations)):
+            # Match.
+            if self.citations[i].cite_id == cite_id:
+                return i + 1
 
 
     def software_setup(self, name, version=None, url=None, vendor_name=None, 
cite_ids=None, tasks=None):




Related Messages


Powered by MHonArc, Updated Wed Oct 14 15:40:01 2009