The test for whether a parent of rank can have a child of rank pc can be rephrased like this: are there any ranks
between
and p that
are not optional?
c
# - - - H i e r . c a n P a r e n t H a v e C h i l d - - -
def canParentHaveChild ( self, p, c ):
"""Can a taxon of rank p have an immediate child of rank c?
"""
#-- 1 --
for rankIndex in range ( p.depth+1, c.depth ):
#-- 1 body --
# [ if self.__rankList[rankIndex] is not optional ->
# return 0
# else -> I ]
m = self.__rankList[rankIndex]
if not m.isOptional:
return 0
#-- 2 --
return 1