* src/Date.py (get_high_year): Add method to return upper estimate.

* src/AddSpouse.py: Correctly use upper and lower date estimates.
* src/ChooseParents: Correctly use upper and lower date estimates.


svn: r3565
This commit is contained in:
Alex Roitman 2004-09-21 02:10:23 +00:00
parent 8902c3e35e
commit 523a3b3943
4 changed files with 25 additions and 8 deletions

View File

@ -19,6 +19,10 @@
* src/DateEdit.py: Use new Date's set() method. Enable help.
* src/Date.py (get_high_year): Add method to return upper estimate.
* src/AddSpouse.py: Correctly use upper and lower date estimates.
* src/ChooseParents: Correctly use upper and lower date estimates.
2004-09-19 Alex Roitman <shura@alex.neuro.umn.edu>
* src/Date.py (is_equal): Add method -- needed to compare dates
for being identical, since __cmp__ only compares the sorting value

View File

@ -312,19 +312,19 @@ class AddSpouse:
if pdday.get_year_valid():
# reject if person birthdate is after the spouse deathdate
if self.bday.get_low_year() + 10 > pdday.get_high_year():
if self.bday.get_year() + 10 > pdday.get_high_year():
return 0
# reject if person birthdate is more than 100 years
# before the spouse deathdate
if self.bday.get_high_year() + 100 < pdday.get_low_year():
if self.bday.get_high_year() + 100 < pdday.get_year():
return 0
if self.dday.get_year_valid():
if pbday.get_year_valid():
# reject if person deathdate was prior to
# the spouse birthdate
if self.dday.get_high_year() < pbday.get_low_year() + 10:
if self.dday.get_high_year() < pbday.get_year() + 10:
return 0
if pdday.get_year_valid():

View File

@ -279,27 +279,27 @@ class ChooseParents:
if self.bday and self.bday.get_year_valid():
if pbday and pbday.get_year_valid():
# reject if parents birthdate + 10 > child birthdate
if pbday.get_low_year()+10 > self.bday.get_high_year():
if pbday.get_year()+10 > self.bday.get_high_year():
return 0
# reject if parents birthdate + 90 < child birthdate
if pbday.get_high_year()+90 < self.bday.get_low_year():
if pbday.get_high_year()+90 < self.bday.get_year():
return 0
if pdday and pdday.get_year_valid():
# reject if parents birthdate + 10 > child deathdate
if self.dday and pbday.get_low_year()+10 > self.dday.get_high_year():
if self.dday and pbday.get_year()+10 > self.dday.get_high_year():
return 0
if self.dday and self.dday.get_year_valid():
if pbday and pbday.get_year_valid():
# reject if parents deathday + 3 < childs birth date
if pdday and self.bday and pdday.get_high_year()+3 < self.bday.get_low_year():
if pdday and self.bday and pdday.get_high_year()+3 < self.bday.get_year():
return 0
if pdday and pdday.get_year_valid():
# reject if parents deathday + 150 < childs death date
if pdday.get_high_year() + 150 < self.dday.get_low_year():
if pdday.get_high_year() + 150 < self.dday.get_year():
return 0
return 1

View File

@ -367,6 +367,19 @@ class Date:
"""
return self._get_high_item(_POS_RDAY)
def get_high_year(self):
"""
Returns the high year estimate. For compound dates with non-zero
stop year, the stop year is returned. Otherwise, the start year
is returned.
"""
if self.is_compound():
ret = self.get_stop_year()
if ret:
return ret
else:
return self.get_year()
def get_text(self):
"""
Returns the text value associated with an invalid date.