# Tai Sakuma <tai.sakuma@cern.ch>

##____________________________________________________________________________||
class EventReaderCollectorAssociator(object):

    """This class relates event readers and a result collector.

    An instance of this class is initialized with a reader class and a
    collector.

    When the method ``make()`` is called with a data set name, this
    class creates a reader, provide the collector with the pair of
    the data set name and the reader, and returns the reader.

    After the readers read events, the mothod ``collect`` is called.
    This method, in turn, calls the method ``collect`` of the
    collector.

    """

    def __init__(self, ReaderClass, resultCollector = None):
        self._ReaderClass = ReaderClass
        self.collector = resultCollector if resultCollector is not None else NullCollector()

    def make(self, datasetName):
        reader = self._ReaderClass()
        self.collector.addReader(datasetName, reader)
        return reader

    def collect(self):
        return self.collector.collect()

##____________________________________________________________________________||
class NullCollector(object):
    def collect(self): return None
    def addReader(self, datasetName, reader): pass

##____________________________________________________________________________||

@@ -178,11 +178,14 @@
 ass 
-rel
+associ
 ates
@@ -315,16 +315,514 @@
 r.%0A%0A    
+An example of a reader class is %60Counter%60. The class itself rather%0A    than its instance needs to be given. Alternatively, an instance of%0A    a factory of instances of the reader class can be given as well.%0A    For example, instead of the class %60Counter%60, an instance of its%0A    factory class %60CounterFactory%60 can be given as well.%0A%0A    An example of a collector is %60Collector%60. Unlike the reader class%0A    mentioned above, an instance of %60Collector%60 not the class itself%0A    should be given.%0A%0A    
 When the
@@ -833,17 +833,16 @@
 hod 
-%60
 %60make()%60
 %60 is
@@ -837,17 +837,16 @@
 %60make()%60
-%60
  is call
@@ -945,16 +945,16 @@
 r of
-%0A   
  the
+%0A   
  dat
@@ -1049,15 +1049,14 @@
 he m
-o
+e
 thod 
-%60
 %60col
@@ -1060,17 +1060,16 @@
 collect%60
-%60
  is call
@@ -1115,17 +1115,16 @@
  method 
-%60
 %60collect
@@ -1128,20 +1128,15 @@
 ect%60
-%60
  of the
-%0A   
  col
@@ -1377,24 +1377,252 @@
 tasetName):%0A
+        %22%22%22make a reader and associates it with the collector.%0A%0A%0A        Args:%0A            datasetName (str): the name of the data set that the reader will read%0A%0A        Returns:%0A            the reader that is made%0A%0A        %22%22%22%0A
         read

update docstring in EventReaderCollectorAssociator