Each instance of this class represents one level of taxonomic classification, such as families or species.
# - - - - - c l a s s R a n k
class Rank(object):
'''Represents one taxonomic level.
Exports:
Rank ( depth, scan ):
[ (depth is a nonnegative int) and
(scan is a Scan instance) ->
if the current line in scan is a valid ranks
file line ->
scan := scan advanced to the end of the line
return a new Rank instance representing that
line, with parent (hier) and depth (depth)
else ->
scan := scan advanced no further than end of line
Log() +:= error message(s)
raise SyntaxError ]
.depth: [ depth of this rank, >= 0 ]
.code: [ rank code for this rank, no trailing spaces ]
.required:
[ if this rank must be present in any taxonomy -> True
else -> False ]
.keyLen:
[ number of digits this rank contributes to a taxonomic
key number ('txKey') ]
.name: [ rank's name, e.g., "Subgenus" ]
.__cmp__(self, other):
[ if self is higher than other -> return -1
else if self is deeper than other -> return 1
else -> return 0 ]
.__str__(self):
[ return a string representation of self ]
.writeXML ( parent ):
[ parent is an et.Element ->
parent := parent with an rnc.RANK_N element added
representing self ]
'''