Next / Previous / Contents / Shipman's homepage

13. class Sighting: Sighting group

An instance of this class may represent either a form element with no floc children, or one floc child.

birdnotes.py
# - - - - -   c l a s s   S i g h t i n g

class Sighting:
    """Represents one sighting of one or more similar birds.

      Exports:
        Sighting(birdForm):
          [ birdForm is a BirdForm instance ->
              birdForm  +:=  a new, empty Sighting instance with
                             birdForm as its parent ]
              return that new instance ]
        .birdForm:    [ as passed to constructor, read-only ]
        .locGroup:
          [ if self has locality content ->
              a LocGroup instance representing that content
            else -> None ]
        .ageSexGroup:
          [ if self has any age-sex-group content ->
              an AgeSexGroup instance representing that content
            else -> None ]
        .sightNotes:
          [ if self has any sighting-notes content ->
              a SightNotes instance representing that content
            else -> None ]
        .getLocGroup():
          [ return self's locality as a LocGroup object ]

This method is used to translate a sighting to XML.

birdnotes.py
        .writeNode(formNode):
          [ formNode is an et.Element ->
              formNode  +:=  a new rnc.FLOC_N child made from self ]
    """

13.1. Sighting.__init__()

birdnotes.py
# - - -   S i g h t i n g . _ _ i n i t _ _

    def __init__(self, birdForm):
        """Constructor for Sighting.
        """
        self.birdForm = birdForm
        self.locGroup = None
        self.ageSexGroup = None
        self.sightNotes = None
        birdForm.addSighting(self)