Next / Previous / Contents / TCC Help System / NM Tech homepage

46. class ColumnLayout: Column layout controller

This abstract class controls the way effort keys are related to logical column numbers. It supplies two functions:

Here is the formal interface.

cbchistlib.py
# - - - - -   c l a s s   C o l u m n L a y o u t

class ColumnLayout(object):
    '''Base class for column dispatchers.

      Exports:
        ColumnLayout(effKeyList):
          [ effKeyList is an iterable containing EffortKey
            instances ->
              return a new ColumnLayout instance for those
              EffortKey instances ]
        .__len__(self):
          [ returns the number of logical columns in self ]
        .findColumn(effKey):
          [ effKey is an EffortKey instance ->
              if effKey is in self ->
                return the logical column index that displays
                data from the effort with key (effKey)
              else -> raise KeyError ]
        .label(colx):
          [ colx is an int ->
              if colx is a logical column in self ->
                return that column's label as a string
              else -> raise KeyError ]

      State/Invariants:
        ._nCols:   [ number of logical columns in self ]
    '''
    def __len__(self):
        return self._nCols

    def __init__(self, effKeyList):
        raise NotImplementedError("ColumnLayout.__init__ is a "
                                  "virtual method.")

    def findColumn(self, effKey):
        raise NotImplementedError("ColumnLayout.findColumn is a "
                                  "virtual method.")

    def label(self, effKey):
        raise NotImplementedError("ColumnLayout.label is a "
                                  "virtual method.")