示例#1
0
/*
 * This function finds the interval in which attributeValue is placed. ID and name will be returned. since all the names are returned once
 * in generateListOfIdsAndNames, all names are returned as "" to save copying string values.
 */
std::pair<unsigned , std::string> RangeFacetHelper::generateIDAndName(const TypedValue & attributeValue){
	if(attributeValue >= end){
		return std::make_pair(numberOfBuckets-1 , "");
	}
	unsigned bucketId = attributeValue.findIndexOfContainingInterval(start, end, gap);
    if(bucketId == -1){ // Something has gone wrong and Score class has been unable to calculate the index.
    	ASSERT(false);
        return std::make_pair(0 , "");;
    }
    if(bucketId >= numberOfBuckets){
    	bucketId =  numberOfBuckets - 1;
    }
    return std::make_pair(bucketId , "");
}