Example #1
0
 def __init__(self, value):
     # Initializing the super constructor
     DataTypeArray.__init__(self)
     # checking the type of the parameter
     
     # value is string
     if type(value) is str:
         temp_list = JTString.divide_by_whitespace(value)
         for substring in temp_list:
             self.valuearray.append(Binary(substring))
         for subbinary in self.valuearray:
             self.decimalarray.append(subbinary.get_decimalvalue())
             self.stringarray.append(subbinary.get_string())
     
     # value is list
     elif type(value) is list:
         # list consists of integers
         if type(value[0]) is int:
             for subvalue in value:
                 self.decimalarray.append(subvalue)
                 self.valuearray.append(Binary(subvalue))
             for subbinary in self.valuearray:
                 self.stringarray.append(subbinary.get_string())
         # list consists of DataTypes
         elif isinstance(value[0], DataType):
             for datatype in value:
                 self.decimalarray.append(datatype.get_decimalvalue())
             for integer in self.decimalarray:
                 self.valuearray.append(Binary(integer))
             for subvalue in self.valuearray:
                 self.stringarray.append(subvalue.get_string())
     
     # value is DataType Array
     elif isinstance(value, DataTypeArray):
         self.decimalarray = value.decimalarray
         for integer in self.decimalarray:
             self.valuearray.append(Binary(integer))
         for subvalue in self.valuearray:
             self.stringarray.append(subvalue.get_string())
             
     # creating the stringvalue attribute
     self._calcstringvalue()