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


Java NumberTools.longToString方法代码示例

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


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

示例1: doubleToIndexableString

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * Converts a double value to a String that can be indexed for search.
 * @param value the value to convert
 * @return the indexable string
 */
protected static String doubleToIndexableString(Double value, int precision) {
  if (value == null) {
    return null;
  } else {
    long lConversionFactor = (long)Math.pow((double)10,(double)precision);
    long lValue = Math.round(lConversionFactor * value);
    return NumberTools.longToString(lValue);
  }
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:15,代码来源:DoubleField.java

示例2: longToIndexableString

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * Converts a long value to a String that can be indexed for search.
 * @param value the value to convert
 * @return the indexable string
 */
protected static String longToIndexableString(Long value) {
  if (value == null) {
    return null;
  } else {
    return NumberTools.longToString(value);
  }
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:13,代码来源:LongField.java

示例3: getRangeQuery

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * This will look to see if "part1" or "part2" are strings of all digits,
 * if they are, then they will be converted to a lexicographically safe string
 * representation, then passed into the inherited getRangeQuery().  This is needed when
 * comparing something like "4" to be less than "10".
 * If the strings don't fit the pattern of all digits, then they get passed through
 * to the inherited getRangeQuery().
 */
protected Query getRangeQuery(String field,
        String part1,
        String part2,
        boolean inclusive) throws ParseException {
    if (isDate(part1) && isDate(part2)) {
        if (log.isDebugEnabled()) {
            log.debug("Detected passed in terms are dates, creating " +
                "ConstantScoreRangeQuery(" + field + ", " + part1 + ", " +
                part2 + ", " + inclusive + ", " + inclusive);
        }
        return new ConstantScoreRangeQuery(field, part1, part2, inclusive,
                inclusive);
    }
    String newPart1 = part1;
    String newPart2 = part2;
    String regEx = "(\\d)*";
    Pattern pattern = Pattern.compile(regEx);
    Matcher matcher1 = pattern.matcher(part1);
    Matcher matcher2 = pattern.matcher(part2);
    if (matcher1.matches() && matcher2.matches()) {
        newPart1 = NumberTools.longToString(Long.parseLong(part1));
        newPart2 = NumberTools.longToString(Long.parseLong(part2));
        if (log.isDebugEnabled()) {
            log.debug("NGramQueryParser.getRangeQuery() Converted " + part1 + " to " +
                newPart1 + ", Converted " + part2 + " to " + newPart2);
        }
    }
    return super.getRangeQuery(field, newPart1, newPart2, inclusive);
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:38,代码来源:NGramQueryParser.java

示例4: setCpuBogoMIPS

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * @param cpuBogoMIPSIn the cpuBogoMIPS to set
 */
public void setCpuBogoMIPS(String cpuBogoMIPSIn) {
    if (cpuBogoMIPSIn != null) {
        Float f = Float.parseFloat(cpuBogoMIPSIn);
        this.cpuBogoMIPS = NumberTools.longToString(f.longValue());
    }
    else {
        this.cpuBogoMIPS = null;
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:13,代码来源:Server.java

示例5: setCpuMHz

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * @param cpuMHzIn the cpuMHz to set
 */
public void setCpuMHz(String cpuMHzIn) {
    if (cpuMHzIn != null) {
        this.cpuMHz = NumberTools.longToString(Long.parseLong(cpuMHzIn));
    }
    else {
        this.cpuMHz = null;
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:Server.java

示例6: setCpuNumberOfCpus

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * @param cpuNumberOfCpusIn the cpuNumberOfCpus to set
 */
public void setCpuNumberOfCpus(String cpuNumberOfCpusIn) {
    if (cpuNumberOfCpusIn != null) {
        this.cpuNumberOfCpus =
            NumberTools.longToString(Long.parseLong(cpuNumberOfCpusIn));
    }
    else {
        this.cpuNumberOfCpus = null;
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:13,代码来源:Server.java

示例7: setRam

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * @param ramIn the ram to set
 */
public void setRam(String ramIn) {
    if (ramIn != null) {
        this.ram = NumberTools.longToString(Long.parseLong(ramIn));
    }
    else {
        this.ram = null;
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:Server.java

示例8: setSwap

import org.apache.lucene.document.NumberTools; //导入方法依赖的package包/类
/**
 * @param swapIn the swap to set
 */
public void setSwap(String swapIn) {
    if (swapIn != null) {
        this.swap = NumberTools.longToString(Long.parseLong(swapIn));
    }
    else {
        this.swap = null;
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:Server.java


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