本文整理汇总了C++中StringBuffer::appendFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::appendFloat方法的具体用法?C++ StringBuffer::appendFloat怎么用?C++ StringBuffer::appendFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::appendFloat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: explain
void PhraseScorer::explain(int32_t _doc, Explanation* tfExplanation) {
while (next() && doc() < _doc){
}
float_t phraseFreq = (doc() == _doc) ? freq : 0.0f;
tfExplanation->setValue(getSimilarity()->tf(phraseFreq));
StringBuffer buf;
buf.append(_T("tf(phraseFreq="));
buf.appendFloat(phraseFreq,2);
buf.append(_T(")"));
tfExplanation->setDescription(buf.getBuffer());
}
示例2: toString
///todo: mem leaks
TCHAR* Explanation::toString(int32_t depth) {
StringBuffer buffer;
for (int32_t i = 0; i < depth; i++) {
buffer.append(_T(" "));
}
buffer.appendFloat(getValue(),2);
buffer.append(_T(" = "));
buffer.append(getDescription());
buffer.append(_T("\n"));
for ( uint32_t j=0;j<details.size();j++ ){
TCHAR* tmp = details[j]->toString(depth+1);
buffer.append(tmp);
_CLDELETE_CARRAY(tmp);
}
return buffer.toString();
}
示例3: toString
/** Prints a user-readable version of this query. */
TCHAR* RangeQuery::toString(const TCHAR* field) const
{
StringBuffer buffer;
if ( field==NULL || _tcscmp(getField(),field)!=0 )
{
buffer.append( getField() );
buffer.append( _T(":"));
}
buffer.append(inclusive ? _T("[") : _T("{"));
buffer.append(lowerTerm != NULL ? lowerTerm->text() : _T("NULL"));
buffer.append(_T(" TO "));
buffer.append(upperTerm != NULL ? upperTerm->text() : _T("NULL"));
buffer.append(inclusive ? _T("]") : _T("}"));
if (getBoost() != 1.0f)
{
buffer.append( _T("^"));
buffer.appendFloat( getBoost(),1 );
}
return buffer.toString();
}
示例4: toHtml
///todo: mem leaks
TCHAR* Explanation::toHtml() {
StringBuffer buffer;
TCHAR* tmp;
buffer.append(_T("<ul>\n"));
buffer.append(_T("<li>"));
buffer.appendFloat(getValue(),2);
buffer.append(_T(" = "));
buffer.append(getDescription());
buffer.append(_T("</li>\n"));
for ( uint32_t i=0;i<details.size();i++ ){
tmp = details[i]->toHtml();
buffer.append(tmp);
_CLDELETE_CARRAY(tmp);
}
buffer.append(_T("</ul>\n"));
return buffer.toString();
}
示例5: if
UChar *BooleanQuery::toString(const UChar *field) const
{
StringBuffer buffer;
if (getBoost() != 1.0) {
buffer.append(_T("("));
}
UChar *buf;
BooleanClause* c;
bool isBooleanQuery;
size_t size = clauses.size();
for (uint32_t i = 0 ; i < size; i++) {
c = clauses[i];
isBooleanQuery = c->query->instanceOf(BooleanQuery::getClassName());
if (c->required) // AND clause
buffer.append(_T("+"));
else if (c->prohibited) // NOT clause
buffer.append(_T("-"));
if (isBooleanQuery) // wrap sub-bools in parens
buffer.append(_T("("));
buf = c->query->toString(field);
buffer.append(buf);
_CLDELETE_CARRAY(buf);
if (isBooleanQuery) // wrap sub-bools in parens
buffer.append(_T(")"));
if (i != size - 1)
buffer.append(_T(" "));
if (getBoost() != 1.0) {
buffer.append(_T(")^"));
buffer.appendFloat(getBoost(), 1);
}
}
return buffer.toString();
}
示例6: toString
TCHAR* BooleanQuery::toString(const TCHAR* field) const{
StringBuffer buffer;
if (getBoost() != 1.0) {
buffer.append(_T("("));
}
for (uint32_t i = 0 ; i < clauses.size(); i++) {
BooleanClause* c = clauses[i];
if (c->prohibited)
buffer.append(_T("-"));
else if (c->required)
buffer.append(_T("+"));
if ( c->query->instanceOf(BooleanQuery::getClassName()) ) { // wrap sub-bools in parens
buffer.append(_T("("));
TCHAR* buf = c->query->toString(field);
buffer.append(buf);
_CLDELETE_CARRAY( buf );
buffer.append(_T(")"));
} else {
TCHAR* buf = c->query->toString(field);
buffer.append(buf);
_CLDELETE_CARRAY( buf );
}
if (i != clauses.size()-1)
buffer.append(_T(" "));
if (getBoost() != 1.0) {
buffer.append(_T(")^"));
buffer.appendFloat(getBoost(),1);
}
}
return buffer.toString();
}