Next / Previous / Contents / Shipman's homepage

15. class AgeSexGroup: Sighting core data

This class represents content from the age-sex-group pattern in the schema. See the definition of this pattern in the schema.

birdnotes.py
# - - - - -   c l a s s   A g e S e x G r o u p

class AgeSexGroup:
    """Represents assorted details of birds sighted.

      Exports:
        AgeSexGroup(age=None, sex=None, q=None, count=None,
                    fide=None, long=None):
          [ (age is an age code or None) and
            (sex is a sex code or None) and
            (q is a countability flag or None) and
            (count is a count description string or None) and
            (fide is an attribution or None) and
            (long is a bool, True iff a long entry) ->
              return a new AgeSexGroup instance with those values ]
        .age, .sex, etc.: [ as passed to the constructor, read-only ]
        AgeSexGroup.readNode(node):    # Static method
          [ node is an et.Element ->
              if node has any age-sex-group content ->
                return an AgeSexGroup instance representing that
                content
              else -> return None ]
        .writeNode(parent):
          [ parent is an et.Element ->
              parent  :=  parent with self's age-sex-group
                  content attached ]
    """

15.1. AgeSexGroup.__init__()

birdnotes.py
# - - -   A g e S e x G r o u p . _ _ i n i t _ _

    def __init__(self, age=None, sex=None, q=None, count=None,
                 fide=None, long=False):
        """Constructor for AgeSexGroup.
        """
        self.age = age
        self.sex = sex
        self.q = q
        self.count = count
        self.fide = fide
        self.long = long