Exemple #1
0
    def test_getitem(self):
        s = []
        self.assertEqual(Utils.getItem(s, 4), None)

        s = [[30, 70, 80]]
        self.assertEqual(Utils.getItem(s, 0), 30)

        s = [[70, 80], [90]]
        self.assertEqual(Utils.getItem(s, Utils.seqLength(s)-1), 90)
Exemple #2
0
    def canPrune(self, seq):
        sLowestMIS = self.getStrictlyMinimumMIS(seq)
        k = Utils.seqLength(seq)

        for i in range(k):
            item = Utils.getItem(seq, i)

            if self.MS[item] == sLowestMIS:
                continue

            k_1_subseq = Utils.removeItem(seq, i)

            count = 0
            for d in self.T:
                if Utils.isSubsequence(k_1_subseq, d):
                    count += 1

            if float(count) / len(self.T) < self.getMinMIS(k_1_subseq):
                return True

        return False