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


Java TIntArrayList.clear方法代码示例

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


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

示例1: getEmptyIntArray

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
@NotNull
private TIntArrayList getEmptyIntArray() {
  if (intArrayPool.isEmpty()) {
    return new TIntArrayList(1);
  }
  TIntArrayList list = intArrayPool.pop();
  list.clear();
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ControlFlowAnalyzer.java

示例2: printDocumentsClassificationStatistics

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
/**
 * Print statistics about document and classification.
 *
 * @param docsDB           The documents DB.
 * @param classificationDB The classification DB.
 * @param wantDetails      True if must print more details about the statistics, false
 *                         otherwise.
 */
public static void printDocumentsClassificationStatistics(
        IDocumentDB docsDB, IClassificationDB classificationDB,
        boolean wantDetails) {
    if (docsDB == null)
        throw new NullPointerException(
                "The specified documents DB is 'null'");

    if (classificationDB == null)
        throw new NullPointerException(
                "The specified classification DB is 'null'");

    int docsCount = docsDB.getDocumentsCount();
    double avgCatsPerDoc = 0.0;
    int minCatsPerDoc = Integer.MAX_VALUE;
    TIntArrayList minCatsPerDocDocs = new TIntArrayList();
    int maxCatsPerDoc = Integer.MIN_VALUE;
    TIntArrayList maxCatsPerDocDocs = new TIntArrayList();
    IIntIterator docIt = docsDB.getDocuments();
    docIt.begin();
    while (docIt.hasNext()) {
        int doc = docIt.next();
        int docCats = classificationDB.getDocumentCategoriesCount(doc);
        if (docCats == minCatsPerDoc)
            minCatsPerDocDocs.add(doc);
        if (docCats < minCatsPerDoc) {
            minCatsPerDoc = docCats;
            minCatsPerDocDocs.clear();
            minCatsPerDocDocs.add(doc);
        }
        if (docCats == maxCatsPerDoc)
            maxCatsPerDocDocs.add(doc);
        if (docCats > maxCatsPerDoc) {
            maxCatsPerDoc = docCats;
            maxCatsPerDocDocs.clear();
            maxCatsPerDocDocs.add(doc);
        }
        avgCatsPerDoc += docCats;
    }

    avgCatsPerDoc /= docsCount;

    JatecsLogger.status().println("");
    JatecsLogger.status().println(
            "Average categories per documents: "
                    + Os.generateDouble(avgCatsPerDoc, 3));
    JatecsLogger.status().print(
            "Maximum categories per documents: ["
                    + maxCatsPerDocDocs.size() + "] " + maxCatsPerDoc
                    + " (");
    if (wantDetails) {
        for (int i = 0; i < maxCatsPerDocDocs.size(); ++i) {
            JatecsLogger.status().print(
                    docsDB.getDocumentName(maxCatsPerDocDocs.get(i)) + " ");
        }
    }
    JatecsLogger.status().println(")");
    JatecsLogger.status().print(
            "Minimum categories per documents: ["
                    + minCatsPerDocDocs.size() + "] " + minCatsPerDoc
                    + " (");
    if (wantDetails) {
        for (int i = 0; i < minCatsPerDocDocs.size(); ++i) {
            JatecsLogger.status().print(
                    docsDB.getDocumentName(minCatsPerDocDocs.get(i)) + " ");
        }
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:76,代码来源:IndexStatistics.java


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