void Set_C::Add(__int64_t x, __int64_t groupIdx) { if(nElementNum == MAX_ELEMENT_NUM) { printf("Set exceed maximum element number!\n"); return; } if(0 == GroupSize(groupIdx)) ++nGroupNum; pnGroupIdx[x] = groupIdx; ++pnGroupSize[groupIdx]; ++nElementNum; }
/** * Return the value associated with a given field in the group. * Some fields require special attention. */ wxString BOM_TABLE_GROUP::GetFieldValue( unsigned int aFieldId ) const { wxString value; // Account for special cases switch( aFieldId ) { // QUANTITY returns the size of the group case BOM_COL_ID_QUANTITY: value = wxString::Format( "%u", (unsigned int) GroupSize() ); break; // REFERENCE field returns consolidated list of references case BOM_COL_ID_REFERENCE: value = wxJoin( GetReferences(), ' ' ); break; // Otherwise, return component data default: if( Components.size() == 0 ) { value = wxEmptyString; } else { // If the components in this group contain multiple items, // display a special string indicating this for( unsigned int i=0; i<Components.size(); i++ ) { auto const& cmp = Components[i]; if( i == 0 ) { value = cmp->GetFieldValue( aFieldId ); } // Mismatch found else if( value.Cmp( cmp->GetFieldValue( aFieldId ) ) != 0 ) { value = ROW_MULT_ITEMS; break; } } } break; } return value; }