def __init__(self): AllCombinations.__init__(self) # ??? should this be AllFiles.__init__ ??? self.caseList = [] self.pairs = {} self.caseNumber = 1 self.lists = [] self.row = None
def __init__(self): AllCombinations.__init__( self) # ??? should this be AllFiles.__init__ ??? self.caseList = [] self.pairs = {} self.caseNumber = 1 self.lists = [] self.row = None
def generate(self): numPairsWanted = len(self.lists) * (len(self.lists) - 1) / 2 if numPairsWanted > 1: while numPairsWanted > 0 and len(self.caseList) > 0: i = 0 while i < len(self.caseList): numUngeneratedPairs = self.evaluateCase(self.caseList[i]) if numUngeneratedPairs == 0: del self.caseList[i] elif numUngeneratedPairs >= numPairsWanted: self.addToPairTable(self.caseList[i]) AllCombinations.doCase(self, self.caseList[i]) del self.caseList[i] else: i += 1 numPairsWanted -= 1 else: for case in self.caseList: AllCombinations.doCase(self, case) self.summary["total pairs"] = "%s" % len(self.pairs)