当前位置: 首页>>代码示例>>C++>>正文


C++ TypedValue::minimumValue方法代码示例

本文整理汇总了C++中TypedValue::minimumValue方法的典型用法代码示例。如果您正苦于以下问题:C++ TypedValue::minimumValue方法的具体用法?C++ TypedValue::minimumValue怎么用?C++ TypedValue::minimumValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypedValue的用法示例。


在下文中一共展示了TypedValue::minimumValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateListOfIdsAndNames

/*
 * Example :
 * If we have two attributes : price,model (facet type : range, categorical)
 * and start,end and gap for price are 1,100 and 10. Then this function
 * produces an empty vector for model (because it's categorical) and a vector with the following
 * values for price:
 * -large_value, 1, 11, 21, 31, 41, ..., 91, 101
 */
void RangeFacetHelper::generateListOfIdsAndNames(std::vector<std::pair<unsigned, std::string> > * idsAndNames){

	if(generateListOfIdsAndNamesFlag == true || idsAndNames == NULL){
		ASSERT(false);
		return;
	}
	TypedValue lowerBoundToAdd = start;
    std::vector<TypedValue> lowerBounds;
	// Example : start : 1, gap : 10 , end : 100
	// first -large_value is added as the first category
	// then 1, 11, 21, ...and 91 are added in the loop.
	// and 101 is added after loop.
	lowerBounds.push_back(lowerBoundToAdd.minimumValue()); // to collect data smaller than start
	while (lowerBoundToAdd < end) {
		lowerBounds.push_back(lowerBoundToAdd); // data of normal categories
		lowerBoundToAdd = lowerBoundToAdd + gap;
	}
	lowerBounds.push_back(end); // to collect data greater than end
	// now set the number of buckets
	numberOfBuckets = lowerBounds.size();
	// now fill the output
	for(int lowerBoundsIndex = 0; lowerBoundsIndex < lowerBounds.size() ; lowerBoundsIndex++){
		string bucketName = lowerBounds.at(lowerBoundsIndex).toString();
		/*
		 * If the type of this facet attribute is time, we should translate the number of
		 * seconds from Jan 1st 1970 (aka "epoch") to a human readable representation of time.
		 * For example, if this value is 1381271294, the name of this bucket is 10/8/2013 3:28:14.
		 */
		if(attributeType == ATTRIBUTE_TYPE_TIME){
			long timeValue = lowerBounds.at(lowerBoundsIndex).getTimeTypedValue();
			bucketName = DateAndTimeHandler::convertSecondsFromEpochToDateTimeString(&timeValue);
		}
		idsAndNames->push_back(std::make_pair(lowerBoundsIndex , bucketName));
	}
	// And set the flag to make sure this function is called only once.
	generateListOfIdsAndNamesFlag = false;

}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:46,代码来源:FacetOperator.cpp


注:本文中的TypedValue::minimumValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。