本文整理汇总了Java中gnu.trove.TIntArrayList.remove方法的典型用法代码示例。如果您正苦于以下问题:Java TIntArrayList.remove方法的具体用法?Java TIntArrayList.remove怎么用?Java TIntArrayList.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TIntArrayList
的用法示例。
在下文中一共展示了TIntArrayList.remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
}
}
示例2: 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);
}
}
}
}
}
示例3: removeFromMultiMap
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
private void removeFromMultiMap(int key, int value) {
final TIntObjectHashMap<TIntArrayList> map = myMultipleValuesMap;
if (map == null) return;
TIntArrayList list = map.get(key);
if (list != null) {
int offset = list.indexOf(value);
if (offset != -1) {
list.remove(offset);
if (list.isEmpty()) {
map.remove(key);
}
}
}
}
示例4: removeFeatures
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
for (int i = 0; i < _documentsFeatures.size(); ++i) {
TIntArrayList feats = _documentsFeatures.get(i);
TIntArrayList freqs = _documentsFrequencies.get(i);
int j = 0;
int shift = 0;
int feat;
int rem;
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
while (true) {
if (feat == rem) {
feats.remove(j);
freqs.remove(j);
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
++shift;
} else
break;
} else if (feat > rem) {
if (removedFeatures.hasNext()) {
rem = removedFeatures.next();
++shift;
} else
break;
} else {
feats.setQuick(j, feat - shift);
++j;
if (j < feats.size())
feat = feats.getQuick(j);
else
break;
}
}
++shift;
}
while (j < feats.size()) {
feats.setQuick(j, feats.getQuick(j) - shift);
++j;
}
removedFeatures.begin();
}
_documentLenghts.clear();
_featureDocumentsCount.clear();
}
示例5: removeDocuments
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeDocuments(IIntIterator removedDocuments) {
for (int i = 0; i < _categoriesDocuments.size(); ++i) {
TIntArrayList docs = _categoriesDocuments.get(i);
Vector<Boolean> docsPrimary = _categoriesDocumentsPrimary.get(i);
int j = 0;
int shift = 0;
int doc;
int rem;
if (j < docs.size() && removedDocuments.hasNext()) {
doc = docs.getQuick(j);
rem = removedDocuments.next();
while (true) {
if (doc == rem) {
docs.remove(j);
docsPrimary.remove(j);
if (j < docs.size() && removedDocuments.hasNext()) {
doc = docs.getQuick(j);
rem = removedDocuments.next();
++shift;
} else
break;
} else if (doc > rem) {
if (removedDocuments.hasNext()) {
rem = removedDocuments.next();
++shift;
} else
break;
} else {
docs.setQuick(j, doc - shift);
++j;
if (j < docs.size())
doc = docs.getQuick(j);
else
break;
}
}
++shift;
}
while (j < docs.size()) {
docs.setQuick(j, docs.getQuick(j) - shift);
++j;
}
removedDocuments.begin();
}
}
示例6: removeFeatures
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
for (int i = 0; i < _documentsWeights.size(); ++i) {
TIntDoubleHashMap weigs = _documentsWeights.get(i);
TIntArrayList feats = new TIntArrayList(weigs.size());
TDoubleArrayList weigths = new TDoubleArrayList(weigs.size());
TIntDoubleIterator wit = weigs.iterator();
while (wit.hasNext()) {
wit.advance();
feats.add(wit.key());
weigths.add(wit.value());
}
int j = 0;
int shift = 0;
int feat;
int rem;
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
while (true) {
if (feat == rem) {
feats.remove(j);
weigths.remove(j);
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
++shift;
} else
break;
} else if (feat > rem) {
if (removedFeatures.hasNext()) {
rem = removedFeatures.next();
++shift;
} else
break;
} else {
feats.setQuick(j, feat - shift);
++j;
if (j < feats.size())
feat = feats.getQuick(j);
else
break;
}
}
++shift;
}
while (j < feats.size()) {
feats.setQuick(j, feats.getQuick(j) - shift);
++j;
}
weigs.clear();
for (j = 0; j < feats.size(); ++j)
weigs.put(feats.getQuick(j), weigths.getQuick(j));
removedFeatures.begin();
}
}
示例7: removeFeatures
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
for (int i = 0; i < _categoriesFeatures.size(); ++i) {
TIntArrayList feats = _categoriesFeatures.get(i);
int j = 0;
int shift = 0;
int feat;
int rem;
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
while (true) {
if (feat == rem) {
feats.remove(j);
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
++shift;
} else
break;
} else if (feat > rem) {
if (removedFeatures.hasNext()) {
rem = removedFeatures.next();
++shift;
} else
break;
} else {
feats.setQuick(j, feat - shift);
++j;
if (j < feats.size())
feat = feats.getQuick(j);
else
break;
}
}
}
while (j < feats.size()) {
feats.setQuick(j, feats.getQuick(j) - shift);
++j;
}
removedFeatures.begin();
}
}
示例8: removeDocuments
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeDocuments(IIntIterator removedDocuments) {
for (int i = 0; i < _featuresDocuments.size(); ++i) {
TIntArrayList docs = _featuresDocuments.get(i);
TIntArrayList freqs = _featuresFrequencies.get(i);
int j = 0;
int shift = 0;
int doc;
int rem;
if (j < docs.size() && removedDocuments.hasNext()) {
doc = docs.getQuick(j);
rem = removedDocuments.next();
while (true) {
if (doc == rem) {
docs.remove(j);
freqs.remove(j);
if (j < docs.size() && removedDocuments.hasNext()) {
doc = docs.getQuick(j);
rem = removedDocuments.next();
++shift;
} else
break;
} else if (doc > rem) {
if (removedDocuments.hasNext()) {
rem = removedDocuments.next();
++shift;
} else
break;
} else {
docs.setQuick(j, doc - shift);
++j;
if (j < docs.size())
doc = docs.getQuick(j);
else
break;
}
}
++shift;
}
while (j < docs.size()) {
docs.setQuick(j, docs.getQuick(j) - shift);
++j;
}
removedDocuments.begin();
}
removedDocuments.begin();
while (removedDocuments.hasNext()) {
int document = removedDocuments.next();
_documentFeaturesCount.remove(document);
_documentLenghts.remove(document);
}
}
示例9: removeFeatures
import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
int shift = 0;
while (removedFeatures.hasNext()) {
int feature = removedFeatures.next() - shift;
_featuresDocuments.remove(feature);
_featuresFrequencies.remove(feature);
++shift;
}
removedFeatures.begin();
for (int i = 0; i < _documentsFeatures.size(); ++i) {
TIntArrayList feats = _documentsFeatures.get(i);
TIntArrayList freqs = _documentsFrequencies.get(i);
int j = 0;
shift = 0;
int feat;
int rem;
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
while (true) {
if (feat == rem) {
feats.remove(j);
freqs.remove(j);
if (j < feats.size() && removedFeatures.hasNext()) {
feat = feats.getQuick(j);
rem = removedFeatures.next();
++shift;
} else
break;
} else if (feat > rem) {
if (removedFeatures.hasNext()) {
rem = removedFeatures.next();
++shift;
} else
break;
} else {
feats.setQuick(j, feat - shift);
++j;
if (j < feats.size())
feat = feats.getQuick(j);
else
break;
}
}
++shift;
}
while (j < feats.size()) {
feats.setQuick(j, feats.getQuick(j) - shift);
++j;
}
removedFeatures.begin();
}
_documentLenghts.clear();
}