Ignore:
Timestamp:
Oct 5, 2017, 1:21:22 PM (21 months ago)
Author:
cameron
Message:

Numeric Property Support and missing SpecialCasing?.h file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/UCD-scripts/UCD_property_objects.py

    r5668 r5670  
    133133    def getPropertyKind(self): return "Binary"
    134134
    135     def setID(self, prop_code, long_name):
    136         PropertyObject.setID(self, prop_code, long_name)
    137 
    138135    def addDataRecord(self, cp_lo, cp_hi, v):
    139136        if v==None or v in self.property_value_lookup_map[v] == 'Y':
     
    147144    def __init__(self):
    148145        PropertyObject.__init__(self)
     146        self.cp_value_map = {}
     147        self.NaN_set = empty_uset()
    149148
    150149    def getPropertyKind(self): return "Numeric"
     150
     151    def addDataRecord(self, cp_lo, cp_hi, stringValue):
     152        if stringValue == '':
     153            self.NaN_set = uset_union(self.NaN_set, range_uset(cp_lo, cp_hi))
     154        else:
     155            for cp in range(cp_lo, cp_hi+1):
     156                self.cp_value_map[cp] = stringValue
     157
     158    def finalizeProperty(self):
     159        explicitly_defined_cps = empty_uset()
     160        for cp in self.cp_value_map.keys():
     161            explicitly_defined_cps = uset_union(explicitly_defined_cps, singleton_uset(cp))
     162        # set NaN default
     163        self.NaN_set = uset_union(self.NaN_set, uset_complement(explicitly_defined_cps))
     164
    151165
    152166class ExtensionPropertyObject(PropertyObject):
Note: See TracChangeset for help on using the changeset viewer.