Esempio n. 1
0
    def union(si1, si2):
        if si1.alpha == si2.alpha and si1.beta == si2.beta:
            bigUnion = SpanningInterval(si1.alpha,
                                        Interval.span(si1.i1, si2.i1),
                                        Interval.span(si1.i2,
                                                      si2.i2), si1.beta)
            bigUnionNotInSi1 = si1.complement().intersectInterval(bigUnion)
            bigUnionNotInSi2 = si2.complement().intersectInterval(bigUnion)

            if (all([i.subset(si2) for i in bigUnionNotInSi1])
                    and all([i.subset(si1) for i in bigUnionNotInSi2])):
                return SpanningIntervalSet([bigUnion])

        return SpanningIntervalSet([si1, si2])
Esempio n. 2
0
 def testSpan(self):
     self.assertEqual(
         Interval.span(Interval(OP, 1, 4, OP), Interval(CL, 2, 6, CL)),
         Interval(OP, 1, 6, CL))