'''
### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###
                   308-304 - Object-Oriented Software Design
                                 ASSIGNMENT  4

   CData.py ---
      class CellData implementation. REVIEWED FOR ASSIGNMENT 4

   last modified: 04/03/02
                       ===============================
                             Copyright (c)  2002
                            Jean-Sébastien BOLDUC
                             (jseb@cs.mcgill.ca)

                        McGill University  (Montréal)
                       ===============================

### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###
'''

import types

class CellData:
  '''
  Encapsulated Integer data.
  '''

  ### -------------------------------------------------------------  API -- ###

  def __init__(self, strValue = '', dataType = 'Unknown', value = None):
    ''' strValue:String, dataType:String, value:Integer|Real|None ->

    --  CellData constructor.
    '''
    self.setValue(strValue, dataType, value)

  def getValue(self):
    ''' -> :String, :String, :Integer|Real|None

    Return the object's attribute values.
    '''
    return (self.__strValue, self.__dataType, self.__numValue)

  def setValue(self, strValue = '', dataType = 'Unknown', value = None):
    ''' strValue:String, dataType:String, value:Integer|Real|None ->

    Set the object's attribute values.
    dataType is in ("Unknown", "Integer", "Real", "String", "Formula").
    If dataType is either "Integer" or "Real", value must hold the numerical
    value corresponding to strValue (None otherwise). There is NO TYPECHECKING
    --- this is the subject's responsability.
    '''
    self.__strValue = strValue
    self.__dataType = dataType
    self.__numValue = value

  def __str__(self):
    ''' -> :String

    Return the string representation of the object attribute values.
    '''
    return str((self.__strValue, self.__dataType, self.__numValue))

