Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 57f65280 authored by EXT José Ignacio Requeno Jarabo's avatar EXT José Ignacio Requeno Jarabo
Browse files

Rectangle

 - Changes in the "intersection" method. If self does not intersect other, then "intersection" returns None instead of self
ResultSet
 - Changes in the string printing
parent f226ccc8
Pipeline #33028 passed with stages
in 26 minutes and 37 seconds
......@@ -818,7 +818,7 @@ class Rectangle(object):
Returns:
Rectangle: Intersection of self and other, if any.
Else, self.
Else, None.
Example:
>>> x = (0,0)
......@@ -837,8 +837,8 @@ class Rectangle(object):
maxc = minimum(self.max_corner, other.max_corner)
if less(minc, maxc):
return Rectangle(minc, maxc)
else:
return Rectangle(self.min_corner, self.max_corner)
# else:
# return Rectangle(self.min_corner, self.max_corner)
def intersection_update(self, other):
# type: (Rectangle, Rectangle) -> Rectangle
......@@ -907,9 +907,12 @@ class Rectangle(object):
diff_set = set()
inter = self & other
if inter == self:
diff_set.add(inter)
# inter = self & other
# if inter == self:
# diff_set.add(inter)
inter = self.intersection(other)
if inter is None:
diff_set.add(self)
else:
# ground = self.min_corner
# ceil = self.max_corner
......@@ -975,8 +978,10 @@ class Rectangle(object):
next(b, None)
return zip(a, b)
inter = self & other
if inter == self:
# inter = self & other
# if inter == self:
inter = self.intersection(other)
if inter is None:
yield self
else:
# d is a list with dimension equal to the rectangle dimension.
......
......@@ -39,6 +39,8 @@ import ParetoLib.Search as RootSearch
class ResultSet(object):
def __init__(self, border=list(), ylow=list(), yup=list(), xspace=Rectangle()):
# type: (ResultSet, iter, iter, iter, Rectangle) -> None
assert xspace is not None, 'xspace is None, it must be defined'
# self.border = list(border) is required for forcing the creation of a local list.
# If two ResultSets are created by making an empty call to ResultSet() (i.e., rs1, rs2),
# then rs1.border and rs2.border will point to the same list. Modifications in rs1.border
......@@ -115,13 +117,7 @@ class ResultSet(object):
# if i != dim(self.low) - 1:
# _string += ', '
# _string += ')'
_string = '<'
_string += str(self.yup)
_string += ', '
_string += str(self.ylow)
_string += ', '
_string += str(self.border)
_string += '>'
_string = '<{0}, {1}, {2}>'.format(self.yup, self.ylow, self.border)
return _string
def __repr__(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment