Package CHEM :: Package Common :: Module ResultsFormatter :: Class ResultsFormatter
[hide private]
[frames] | no frames]

Class ResultsFormatter



Abstract class defining what methods a formatter class should implement

Instance Methods [hide private]
 
__init__(self, outFile)
 
getOutFile(self)
 
setOutFile(self, outFile)
 
getGroupColumns(self)
 
setGroupColumns(self, groupColumns)
 
getHeaderRow(self)
 
setHeaderRow(self, headerRow)
 
formatResultSet(self, results)
Just iteratively call formatTuple for the entire result set.
 
formatResultDicts(self, resultDicts, columnNames=None)
Instead of printing out a list of lists, print out a list of dictionaries' values (RowItemModels).
 
formatTuple(self, tuple)
Abstract method, subclasses should override.
Class Variables [hide private]
  outFile = <CHEM.DB.rdb.search.NameRxnPatternMatchingModel.Sear...
Method Details [hide private]

formatResultSet(self, results)

 

Just iteratively call formatTuple for the entire result set.

If groupColumns is true, then, for each item, will check if the item in the immediately preceding tuple was the same. If so, just format a blank string. However, this only applies if all preceding / higher-order items in the tuple have already been blanked by this same criteria. For this all to make sense, the columns should sorted by the first columns, in the order they appear.

formatResultDicts(self, resultDicts, columnNames=None)

 
Instead of printing out a list of lists, print out a list of dictionaries' values (RowItemModels). These will be printed in alphabetical order of the column names (dictionary keys) unless a specific set and order of columns is specified with the columnNames list parameter. Similar to the formatResultSet method, can option to groupColumns to avoid reprinting higher order columns.

formatTuple(self, tuple)

 
Abstract method, subclasses should override. Format the tuple into some string and write it to the outFile.

Class Variable Details [hide private]

outFile

Value:
None