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


Java TIntArrayList.binarySearch方法代码示例

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


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

示例1: addCategoryHierarchicaly

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
protected void addCategoryHierarchicaly(int document, short category, boolean primary) {
    TIntArrayList docs = _classificationDB._categoriesDocuments.get(category);
    Vector<Boolean> docsPrimary = _classificationDB._categoriesDocumentsPrimary.get(category);
    int pos = docs.binarySearch(document);
    if (pos < 0) {
        docs.insert(-pos - 1, document);
        docsPrimary.insertElementAt(primary, -pos - 1);
    } else {
        if (primary) {
            docsPrimary.set(pos, true);
        }
    }

    IShortIterator parents = _classificationDB.getCategoryDB().getParentCategories(category);
    while (parents.hasNext())
        addCategoryHierarchicaly(document, parents.next(), primary);
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:18,代码来源:TroveClassificationILDBBuilder.java

示例2: addCategoryHierarchicaly

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
protected void addCategoryHierarchicaly(int document, short category, boolean primary) {
    TShortArrayList cats = _classificationDB._documentsCategories.get(document);
    Vector<Boolean> catsPrimary = _classificationDB._documentsCatsPrimary.get(document);
    int pos = cats.binarySearch(category);
    if (pos < 0) {
        cats.insert(-pos - 1, category);
        catsPrimary.insertElementAt(primary, -pos - 1);
    } else {

        if (primary) {
            catsPrimary.set(pos, true);
        }
    }

    TIntArrayList docs = _classificationDB._categoriesDocuments.get(category);
    pos = docs.binarySearch(document);
    if (pos < 0) {
        docs.insert(-pos - 1, document);
    }

    IShortIterator parents = _classificationDB.getCategoryDB().getParentCategories(category);
    while (parents.hasNext())
        addCategoryHierarchicaly(document, parents.next(), primary);
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:25,代码来源:TroveClassificationFullDBBuilder.java

示例3: removeCategoryFeatures

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeCategoryFeatures(short category,
                                   IIntIterator removedFeatures) {
    TIntArrayList feats = _categoriesFeatures.get(category);
    while (removedFeatures.hasNext()) {
        int feature = removedFeatures.next();
        if (feats.binarySearch(feature) < 0)
            feats.add(feature);
    }
    feats.sort();
    _hasLocalRepresentation = _hasLocalRepresentation || feats.size() > 0;
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:12,代码来源:TroveDomainDB.java

示例4: setDocumentFeatureFrequency

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void setDocumentFeatureFrequency(int document, int feature, int frequency) {
    if (document >= 0) {
        int size = _contentDB._documentsFeatures.size();
        if (document >= size) {
            for (int i = size; i <= document; ++i) {
                _contentDB._documentsFeatures.add(new TIntArrayList());
                _contentDB._documentsFrequencies.add(new TIntArrayList());
            }
        }
        if (feature >= 0) {
            TIntArrayList feats = _contentDB._documentsFeatures.get(document);
            TIntArrayList freqs = _contentDB._documentsFrequencies.get(document);
            int pos = feats.binarySearch(feature);
            if (pos < 0 && frequency > 0) {
                pos = -pos - 1;
                feats.insert(pos, feature);
                freqs.insert(pos, frequency);
            } else {
                if (frequency > 0) {
                    freqs.setQuick(pos, frequency);
                } else {
                    feats.remove(pos);
                    freqs.remove(pos);
                }
            }
        }
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:29,代码来源:TroveContentDBBuilder.java

示例5: setDocumentFeatureFrequency

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void setDocumentFeatureFrequency(int document, int feature,
                                        int frequency) {
    if (feature >= 0) {
        int size = _contentDB._featuresDocuments.size();
        if (feature >= size) {
            for (int i = size; i <= feature; ++i) {
                _contentDB._featuresDocuments.add(new TIntArrayList());
                _contentDB._featuresFrequencies.add(new TIntArrayList());
            }
        }
        if (document >= 0) {
            TIntArrayList docs = _contentDB._featuresDocuments.get(feature);
            TIntArrayList freqs = _contentDB._featuresFrequencies
                    .get(feature);
            int pos = docs.binarySearch(document);
            if (pos < 0 && frequency > 0) {
                pos = -pos - 1;
                docs.insert(pos, document);
                freqs.insert(pos, frequency);
            } else {
                if (frequency > 0) {
                    freqs.setQuick(pos, frequency);
                } else {
                    docs.remove(pos);
                    freqs.remove(pos);
                }
            }
        }
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:31,代码来源:TroveContentILDBBuilder.java


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