Ignore:
Timestamp:
Sep 16, 2016, 7:47:01 PM (3 years ago)
Author:
cameron
Message:

Support for enumeration basis sets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/PropertyObjects.cpp

    r5158 r5159  
    5353}
    5454
     55std::vector<UnicodeSet> & EnumeratedPropertyObject::GetEnumerationBasisSets() {
     56    // Return the previously computed vector of basis sets, if it exists.
     57    if (enumeration_basis_sets.size() > 0) return enumeration_basis_sets;
     58   
     59    // Otherwise compute and return.
     60    // Basis set i is the set of all codepoints whose numerical enumeration code e
     61    // has bit i set, i.e., (e >> i) & 1 == 1.
     62    unsigned basis_count = 1;
     63    while ((1 << basis_count) < independent_enum_count) basis_count++;
     64    for (unsigned i = 0; i < basis_count; i++) {
     65        enumeration_basis_sets.push_back(UnicodeSet());
     66        for (unsigned e = 0; e < independent_enum_count; e++) {
     67            if (((e >> i) & 1) == 0) {
     68                enumeration_basis_sets[i] = enumeration_basis_sets[i] + *property_value_sets[e];
     69            }
     70        }
     71    }
     72    return enumeration_basis_sets;
     73};
     74
     75   
    5576int EnumeratedPropertyObject::GetPropertyValueEnumCode(const std::string & value_spec) {
    5677    // The canonical full names are not stored in the precomputed alias map,
     
    7192}
    7293
    73 std::vector<UnicodeSet *> EnumeratedPropertyObject::GetEnumerationBasisSets() {
    74     // Basis set i is the set of all codepoints whose numerical enumeration code e
    75     // has bit i set, i.e., (e >> i) & 1 == 1.
    76     unsigned basis_count = 1;
    77     while ((1 << basis_count) < independent_enum_limit) basis_count++;
    78     std::vector<UnicodeSet *> basis_set;
    79     for (unsigned i == 0; i < basis_count; i++) {
    80         basis_set.push_back(new UnicodeSet());
    81         for (unsigned e = 0; e < independent_enum_limit; e++) {
    82             if (((e >> i) & 1) == 0) {
    83                 basis_set[i] = basis_set[i] + property_value_sets[e];
    84             }
    85         }
    86     }
    87 };
    88 
    89    
    90    
    9194PropertyObject::iterator ExtensionPropertyObject::begin() const {
    9295    if (const auto * obj = dyn_cast<EnumeratedPropertyObject>(property_object_table[base_property])) {
Note: See TracChangeset for help on using the changeset viewer.