This method reads the root taxonomy node and recursively adds its descendants.
# - - - T x n y . _ _ r e a d T a x o n o m y - - - def __readTaxonomy ( self, taxonomyNode ): """Build the taxonomy subtree. [ taxonomyNode is a TAXONOMY_N Element node -> self.root := a Taxon instance made from root's TAXONOMY_N subtree, with children representing that subtree self.__txKeyMap := as invariant, from that subtree self.__sciMap := as invariant, from that subtree ] """
First we find the
that roots the classification tree:
#-- 1 -- # [ rootTaxonNode := the TAXON_N node child of taxonomyNode ] rootTaxonNode = taxonomyNode.find ( rnc.TAXON_N )
Then we recursively transform that node and its
descendants into a tree of
instances, storing the new root instance in
#-- 2 -- # [ self.root := a new Taxon instance representing rootTaxonNode # and having descendants made from the descendants of # rootTaxonNode ] self.root = Taxon ( self, None, rootTaxonNode )
We still need to add entries to our internal maps so we can find taxa by taxonomic key or by scientific name:
#-- 3 -- # [ self.__txKeyMap := as invariant, from self.root and its # descendants # self.__sciMap := as invariant, from self.root and its # descendants ] self.__buildMaps()