本文整理汇总了Java中gnu.trove.TIntArrayList类的典型用法代码示例。如果您正苦于以下问题:Java TIntArrayList类的具体用法?Java TIntArrayList怎么用?Java TIntArrayList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TIntArrayList类属于gnu.trove包,在下文中一共展示了TIntArrayList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshTable
import gnu.trove.TIntArrayList; //导入依赖的package包/类
private void refreshTable() {
IDevice[] devices = myDetectedDevicesRef.get();
myDisplayedDevices = devices;
final IDevice[] selectedDevices = getSelectedDevices();
final TIntArrayList selectedRows = new TIntArrayList();
for (int i = 0; i < devices.length; i++) {
if (ArrayUtil.indexOf(selectedDevices, devices[i]) >= 0) {
selectedRows.add(i);
}
}
myProcessSelectionFlag = false;
myDeviceTable.setModel(new MyDeviceTableModel(devices));
if (selectedRows.size() == 0 && devices.length > 0) {
myDeviceTable.getSelectionModel().setSelectionInterval(0, 0);
}
for (int selectedRow : selectedRows.toNativeArray()) {
if (selectedRow < devices.length) {
myDeviceTable.getSelectionModel().addSelectionInterval(selectedRow, selectedRow);
}
}
fireSelectedDevicesChanged();
myProcessSelectionFlag = true;
updatePreviouslySelectedSerials();
}
示例2: TroveContentDB
import gnu.trove.TIntArrayList; //导入依赖的package包/类
public TroveContentDB(IDocumentDB documentsDB, IFeatureDB featuresDB) {
super();
_documentsDB = documentsDB;
_featuresDB = featuresDB;
int size = documentsDB.getDocumentsCount();
_documentsFeatures = new Vector<TIntArrayList>(size);
_documentsFrequencies = new Vector<TIntArrayList>(size);
for (int i = 0; i < size; ++i) {
_documentsFeatures.add(new TIntArrayList());
_documentsFrequencies.add(new TIntArrayList());
}
_documentLenghts = new TIntIntHashMap();
_featureDocumentsCount = new TIntIntHashMap();
_name = "generic";
}
示例3: cloneDB
import gnu.trove.TIntArrayList; //导入依赖的package包/类
public IContentDB cloneDB(IDocumentDB docDB, IFeatureDB featDB) {
TroveContentDB contentDB = new TroveContentDB(docDB, featDB);
contentDB._name = new String(_name);
contentDB._documentsFeatures = new Vector<TIntArrayList>(
_documentsFeatures.size());
for (int i = 0; i < _documentsFeatures.size(); ++i)
contentDB._documentsFeatures.add((TIntArrayList) _documentsFeatures
.get(i).clone());
contentDB._documentsFrequencies = new Vector<TIntArrayList>(
_documentsFrequencies.size());
for (int i = 0; i < _documentsFrequencies.size(); ++i)
contentDB._documentsFrequencies
.add((TIntArrayList) _documentsFrequencies.get(i).clone());
contentDB._documentLenghts = (TIntIntHashMap) _documentLenghts.clone();
contentDB._featureDocumentsCount = (TIntIntHashMap) _featureDocumentsCount
.clone();
return contentDB;
}
示例4: buildChunks
import gnu.trove.TIntArrayList; //导入依赖的package包/类
public static <Node> List<Chunk<Node>> buildChunks(Graph<Node> graph) {
final DFSTBuilder<Node> dfstBuilder = new DFSTBuilder<Node>(graph);
final TIntArrayList sccs = dfstBuilder.getSCCs();
final List<Chunk<Node>> chunks = new ArrayList<Chunk<Node>>();
sccs.forEach(new TIntProcedure() {
int myTNumber = 0;
public boolean execute(int size) {
Set<Node> packs = new LinkedHashSet<Node>();
for (int j = 0; j < size; j++) {
packs.add(dfstBuilder.getNodeByTNumber(myTNumber + j));
}
chunks.add(new Chunk<Node>(packs));
myTNumber += size;
return true;
}
});
return chunks;
}
示例5: refreshTable
import gnu.trove.TIntArrayList; //导入依赖的package包/类
private void refreshTable() {
IDevice[] devices = myDetectedDevicesRef.get();
myDisplayedDevices = devices;
final IDevice[] selectedDevices = getSelectedDevices();
final TIntArrayList selectedRows = new TIntArrayList();
for (int i = 0; i < devices.length; i++) {
if (ArrayUtil.indexOf(selectedDevices, devices[i]) >= 0) {
selectedRows.add(i);
}
}
myProcessSelectionFlag = false;
myDeviceTable.setModel(new MyDeviceTableModel(devices));
if (selectedRows.size() == 0 && devices.length > 0) {
myDeviceTable.getSelectionModel().setSelectionInterval(0, 0);
}
for (int selectedRow : selectedRows.toNativeArray()) {
if (selectedRow < devices.length) {
myDeviceTable.getSelectionModel().addSelectionInterval(selectedRow, selectedRow);
}
}
fireSelectedDevicesChanged();
myProcessSelectionFlag = true;
}
示例6: ExtractClosureHelperImpl
import gnu.trove.TIntArrayList; //导入依赖的package包/类
public ExtractClosureHelperImpl(IntroduceParameterInfo info,
String name,
boolean declareFinal,
TIntArrayList toRemove,
boolean generateDelegate,
int replaceFieldsWithGetters,
boolean forceReturn,
boolean replaceAllOccurrences,
boolean forceDef) {
super(info);
myForceReturn = forceReturn;
myReplaceAllOccurrences = replaceAllOccurrences;
myForceDef = forceDef;
myOwner = info.getToReplaceIn();
myToSearchFor = info.getToSearchFor();
myName = name;
myFinal = declareFinal;
myToRemove = toRemove;
myGenerateDelegate = generateDelegate;
myReplaceFieldsWithGetters = replaceFieldsWithGetters;
}
示例7: removeParametersFromCall
import gnu.trove.TIntArrayList; //导入依赖的package包/类
private static void removeParametersFromCall(@NotNull final PsiExpressionList argList, TIntArrayList parametersToRemove) {
final PsiExpression[] exprs = argList.getExpressions();
parametersToRemove.forEachDescending(new TIntProcedure() {
public boolean execute(final int paramNum) {
try {
if (paramNum < exprs.length) {
exprs[paramNum].delete();
}
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
return true;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaIntroduceParameterMethodUsagesProcessor.java
示例8: calculateWidthIncrease
import gnu.trove.TIntArrayList; //导入依赖的package包/类
/**
* It's possible that we need to expand quick doc control's width in order to provide better visual representation
* (see https://youtrack.jetbrains.com/issue/IDEA-101425). This method calculates that width expand.
*
* @param buttonWidth icon button's width
* @param updatedText text which will be should at the quick doc control
* @return width increase to apply to the target quick doc control (zero if no additional width increase is required)
*/
private static int calculateWidthIncrease(int buttonWidth, String updatedText) {
int maxLineWidth = 0;
TIntArrayList lineWidths = new TIntArrayList();
for (String lineText : StringUtil.split(updatedText, "<br/>")) {
String html = HintUtil.prepareHintText(lineText, HintUtil.getInformationHint());
int width = new JLabel(html).getPreferredSize().width;
maxLineWidth = Math.max(maxLineWidth, width);
lineWidths.add(width);
}
if (!lineWidths.isEmpty()) {
int firstLineAvailableTrailingWidth = maxLineWidth - lineWidths.get(0);
if (firstLineAvailableTrailingWidth >= buttonWidth) {
return 0;
}
else {
return buttonWidth - firstLineAvailableTrailingWidth;
}
}
return 0;
}
示例9: cloneDB
import gnu.trove.TIntArrayList; //导入依赖的package包/类
public IContentDB cloneDB(IDocumentDB documentsDB, IFeatureDB featuresDB) {
TroveContentILDB contentDB = new TroveContentILDB(documentsDB,
featuresDB);
contentDB._name = new String(_name);
contentDB._featuresDocuments = new Vector<TIntArrayList>(
_featuresDocuments.size());
for (int i = 0; i < _featuresDocuments.size(); ++i)
contentDB._featuresDocuments.add((TIntArrayList) _featuresDocuments
.get(i).clone());
contentDB._documentFeaturesCount = (TIntIntHashMap) _documentFeaturesCount
.clone();
contentDB._documentLenghts = (TIntIntHashMap) _documentLenghts.clone();
contentDB._featuresFrequencies = new Vector<TIntArrayList>(
_featuresFrequencies.size());
for (int i = 0; i < _featuresFrequencies.size(); ++i)
contentDB._featuresFrequencies
.add((TIntArrayList) _featuresFrequencies.get(i).clone());
return contentDB;
}
示例10: discard
import gnu.trove.TIntArrayList; //导入依赖的package包/类
private int[] discard(int[] needed, int[] toDiscard, int arrayIndex) {
myOriginalLengths[arrayIndex] = toDiscard.length;
int[] sorted1 = createSorted(needed);
TIntArrayList discarded = new TIntArrayList(toDiscard.length);
TIntArrayList oldIndecies = new TIntArrayList(toDiscard.length);
for (int i = 0; i < toDiscard.length; i++) {
int index = toDiscard[i];
if (Arrays.binarySearch(sorted1, index) >= 0) {
discarded.add(index);
oldIndecies.add(i);
}
}
myOldIndecies[arrayIndex] = oldIndecies.toNativeArray();
myDiscardedLengths[arrayIndex] = discarded.size();
return discarded.toNativeArray();
}
示例11: 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);
}
示例12: setDocumentCategory
import gnu.trove.TIntArrayList; //导入依赖的package包/类
public void setDocumentCategory(int document, short category, boolean primary) {
if (document >= 0 && category >= 0) {
int docsize = _classificationDB._documentsCategories.size();
if (document >= docsize) {
for (int i = docsize; i <= document; ++i) {
_classificationDB._documentsCategories.add(new TShortArrayList());
_classificationDB._documentsCatsPrimary.add(new Vector<Boolean>());
}
}
int catsize = _classificationDB._categoriesDocuments.size();
if (category >= catsize) {
for (int i = catsize; i <= document; ++i)
_classificationDB._categoriesDocuments.add(new TIntArrayList());
}
addCategoryHierarchicaly(document, category, primary);
}
}
示例13: computeInitialCentroids
import gnu.trove.TIntArrayList; //导入依赖的package包/类
protected void computeInitialCentroids(DocumentCentroid[] centroids,
IIntIterator documents, IIndex index) {
TIntArrayList initial = new TIntArrayList();
documents.begin();
while (documents.hasNext()) {
initial.add(documents.next());
}
Random r = new Random();
for (int i = 0; i < centroids.length; i++) {
// Choose random document.
int nextDoc = initial.get(r.nextInt(initial.size()));
TIntArrayList ar = new TIntArrayList();
ar.add(nextDoc);
centroids[i].features = Clustering.computeDocumentCentroid(
new TIntArrayListIterator(ar), index);
}
}
示例14: computeInitialCentroidsNormal
import gnu.trove.TIntArrayList; //导入依赖的package包/类
protected void computeInitialCentroidsNormal(DocumentCentroid[] centroids,
IIntIterator documents, IIndex index) {
TIntArrayList initial = new TIntArrayList();
documents.begin();
while (documents.hasNext()) {
initial.add(documents.next());
}
Random r = new Random();
for (int i = 0; i < centroids.length; i++) {
// Choose random document.
int nextDoc = initial.get(r.nextInt(initial.size()));
TIntArrayList ar = new TIntArrayList();
ar.add(nextDoc);
centroids[i].features = Clustering.computeDocumentCentroid(
new TIntArrayListIterator(ar), index);
}
}
示例15: save
import gnu.trove.TIntArrayList; //导入依赖的package包/类
@Override
public void save(@NotNull DataOutput out, TIntArrayList list) throws IOException {
if (list.size() == 2) {
DataInputOutputUtil.writeINT(out, list.getQuick(0));
DataInputOutputUtil.writeINT(out, list.getQuick(1));
}
else {
DataInputOutputUtil.writeINT(out, -list.size());
int prev = 0;
for (int i = 0, len = list.size(); i < len; i+=2) {
int value = list.getQuick(i);
DataInputOutputUtil.writeINT(out, value - prev);
prev = value;
DataInputOutputUtil.writeINT(out, list.getQuick(i + 1));
}
}
}