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


Java TIntArrayList.add方法代码示例

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


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

示例1: splitPerCategory

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
protected HashMap<Short, TIntArrayList> splitPerCategory(IIndex index) {
    HashMap<Short, TIntArrayList> map = new HashMap<Short, TIntArrayList>();
    IShortIterator cats = index.getCategoryDB().getCategories();
    while (cats.hasNext()) {
        short catID = cats.next();
        IIntIterator docs = index.getClassificationDB().getCategoryDocuments(catID);
        TIntArrayList l = new TIntArrayList();
        map.put(catID, l);
        while (docs.hasNext()) {
            int docID = docs.next();
            assert (index.getClassificationDB().getDocumentCategoriesCount(docID) == 1);
            l.add(docID);
        }
    }

    return map;
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:18,代码来源:KFoldEvaluatorRegression.java

示例2: calcInjections

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
@NotNull
protected static TreeMap<TextRange, BaseInjection> calcInjections(PsiFile file) {
  final TreeMap<TextRange, BaseInjection> injectionMap = new TreeMap<TextRange, BaseInjection>(RANGE_COMPARATOR);

  TIntArrayList ints = new TIntArrayList();
  StringSearcher searcher = new StringSearcher("language=", true, true, false);
  CharSequence contents = file.getViewProvider().getContents();
  final char[] contentsArray = CharArrayUtil.fromSequenceWithoutCopying(contents);

  int s0 = 0, s1 = contents.length();
  for (int idx = searcher.scan(contents, contentsArray, s0, s1);
       idx != -1;
       idx = searcher.scan(contents, contentsArray, idx + 1, s1)) {
    ints.add(idx);
    PsiComment element = PsiTreeUtil.findElementOfClassAtOffset(file, idx, PsiComment.class, false);
    if (element != null) {
      String str = ElementManipulators.getValueText(element).trim();
      BaseInjection injection = detectInjectionFromText("", str);
      if (injection != null) {
        injectionMap.put(element.getTextRange(), injection);
      }
    }
  }
  return injectionMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InjectorUtils.java

示例3: doHighlighting

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
@NotNull
protected List<HighlightInfo> doHighlighting() {
  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

  TIntArrayList toIgnoreList = new TIntArrayList();
  if (!doFolding()) {
    toIgnoreList.add(Pass.UPDATE_FOLDING);
  }
  if (!doInspections()) {
    toIgnoreList.add(Pass.LOCAL_INSPECTIONS);
    toIgnoreList.add(Pass.WHOLE_FILE_LOCAL_INSPECTIONS);
  }
  int[] toIgnore = toIgnoreList.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : toIgnoreList.toNativeArray();
  Editor editor = getEditor();
  PsiFile file = getFile();
  if (editor instanceof EditorWindow) {
    editor = ((EditorWindow)editor).getDelegate();
    file = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file);
  }

  return CodeInsightTestFixtureImpl.instantiateAndRun(file, editor, toIgnore, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LightDaemonAnalyzerTestCase.java

示例4: 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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:Reindexer.java

示例5: 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);
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:20,代码来源:KMeansDocumentClusterizer.java

示例6: selectNegatives

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public TIntArrayListIterator selectNegatives(String category) {

        short catID = _index.getCategoryDB().getCategory(category);

        TreeSet<Item> best = _best.get(catID);
        assert (best != null);

        TIntArrayList neg = new TIntArrayList();
        Iterator<Item> it = best.iterator();
        while (it.hasNext()) {
            Item docS = it.next();
            assert (!neg.contains(docS.docID));
            neg.add(docS.docID);
        }

        neg.sort();

        return new TIntArrayListIterator(neg);
    }
 
开发者ID:jatecs,项目名称:jatecs,代码行数:20,代码来源:BestKNNNegativesChooser.java

示例7: readIntArray

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public static int[] readIntArray(JsonReaderEx reader) {
  checkIsNull(reader, null);
  reader.beginArray();
  if (!reader.hasNext()) {
    reader.endArray();
    return ArrayUtilRt.EMPTY_INT_ARRAY;
  }

  TIntArrayList result = new TIntArrayList();
  do {
    result.add(reader.nextInt());
  }
  while (reader.hasNext());
  reader.endArray();
  return result.toNativeArray();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JsonReaders.java

示例8: getFeatureDocuments

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public IIntIterator getFeatureDocuments(int feature) {
    IIntIterator docIt = _documentsDB.getDocuments();
    int document = 0;
    TIntArrayList documents = new TIntArrayList();
    while (docIt.hasNext()) {
        document = docIt.next();
        if (hasDocumentFeature(document, feature))
            documents.add(document);
    }
    return new TIntArrayListIterator(documents);
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:12,代码来源:TroveContentDB.java

示例9: computeTSR

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
@Override
public void computeTSR(IIndex index) {
    TextualProgressBar bar = new TextualProgressBar(
            "Compute TSR with by using regex matcher");
    int total = index.getFeatureDB().getFeaturesCount();
    int step = 0;

    TIntArrayList toRemove = new TIntArrayList();

    IIntIterator it = index.getFeatureDB().getFeatures();
    while (it.hasNext()) {
        int featID = it.next();
        String featName = index.getFeatureDB().getFeatureName(featID);
        if (!featName.matches(regexPatternMatching)) {
            toRemove.add(featID);
        }

        step++;
        bar.signal((step * 100) / total);
    }

    bar.signal(100);

    toRemove.sort();

    // Remove the worst features.
    JatecsLogger.status().print("Removing worst features...");

    index.removeFeatures(new TIntArrayListIterator(toRemove));

    JatecsLogger.status().println(
            "done. Now the DB contains "
                    + index.getFeatureDB().getFeaturesCount()
                    + " feature(s).");

}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:37,代码来源:RegexTSR.java

示例10: add

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
@Override
public void add(int hash, int cost, @Nullable PsiFragment frag) {
  if (!isIndexedFragment(frag, cost, myProfile, myDuplocatorState)) {
    return;
  }

  if (myTracingData != null) myTracingData.record(hash, cost, frag);

  TIntArrayList list = myMap.get(hash);
  if (list == null) { myMap.put(hash, list = new TIntArrayList()); }
  list.add(frag.getStartOffset());
  list.add(0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DuplicatesIndex.java

示例11: unescapePercentSequences

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
@NotNull
public static String unescapePercentSequences(@NotNull String s) {
  if (s.indexOf('%') == -1) {
    return s;
  }

  StringBuilder decoded = new StringBuilder();
  final int len = s.length();
  int i = 0;
  while (i < len) {
    char c = s.charAt(i);
    if (c == '%') {
      TIntArrayList bytes = new TIntArrayList();
      while (i + 2 < len && s.charAt(i) == '%') {
        final int d1 = decode(s.charAt(i + 1));
        final int d2 = decode(s.charAt(i + 2));
        if (d1 != -1 && d2 != -1) {
          bytes.add(((d1 & 0xf) << 4 | d2 & 0xf));
          i += 3;
        }
        else {
          break;
        }
      }
      if (!bytes.isEmpty()) {
        final byte[] bytesArray = new byte[bytes.size()];
        for (int j = 0; j < bytes.size(); j++) {
          bytesArray[j] = (byte)bytes.getQuick(j);
        }
        decoded.append(new String(bytesArray, CharsetToolkit.UTF8_CHARSET));
        continue;
      }
    }

    decoded.append(c);
    i++;
  }
  return decoded.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:URLUtil.java

示例12: getUnusedFeatures

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public IIntIterator getUnusedFeatures() {
    TIntArrayList zeroFeatures = new TIntArrayList();
    IIntIterator it = _featuresDB.getFeatures();
    while (it.hasNext()) {
        int feat = it.next();
        if (getFeatureDocumentsCount(feat) == 0)
            zeroFeatures.add(feat);
    }

    return new TIntArrayListIterator(zeroFeatures);
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:12,代码来源:TroveContentFullDB.java

示例13: selectPositives

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
protected IIndex selectPositives(short catID, IIndex training) {
    // First create a new index.
    IIndex idx = training.cloneIndex();

    IShortIterator childCats = getAllChildsCategoriesFor(idx, catID);
    short nextCatID = Short.MIN_VALUE;
    if (childCats.hasNext())
        nextCatID = childCats.next();

    // Remove unwanted categories.
    TShortArrayList toRemove = new TShortArrayList();
    for (short i = 0; i < training.getCategoryDB().getCategoriesCount(); i++) {
        if (i == nextCatID) {
            if (childCats.hasNext())
                nextCatID = childCats.next();
            continue;
        }

        toRemove.add(i);
    }
    toRemove.sort();
    idx.removeCategories(new TShortArrayListIterator(toRemove));

    // Remove unwanted documents.
    TIntArrayList docsToRemove = new TIntArrayList();
    IIntIterator docs = idx.getDocumentDB().getDocuments();
    while (docs.hasNext()) {
        int docID = docs.next();
        IShortIterator curCats = idx.getClassificationDB()
                .getDocumentCategories(docID);
        if (!curCats.hasNext())
            docsToRemove.add(docID);
    }

    docsToRemove.sort();
    idx.removeDocuments(new TIntArrayListIterator(docsToRemove), false);

    return idx;
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:40,代码来源:SingleLabelTreeBoostLearner.java

示例14: FoldingTransformation

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public FoldingTransformation(Editor editor) {
  myEditor = editor;
  FoldRegion[] foldRegions = myEditor.getFoldingModel().getAllFoldRegions();
  Arrays.sort(foldRegions, RangeMarker.BY_START_OFFSET);
  TIntArrayList foldBeginings = new TIntArrayList();
  for (FoldRegion foldRegion : foldRegions) {
    if (!foldRegion.isValid() || foldRegion.isExpanded()) continue;
    foldBeginings.add(getStartLine(foldRegion));
    myCollapsed.add(foldRegion);
  }
  myFoldBeginings = foldBeginings.toNativeArray();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FoldingTransformation.java

示例15: computeExpectations

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][][] xis;
  TIntArrayList cache = new TIntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattices.get(i).getInput();
    SumLattice lattice = lattices.get(i);
    xis = lattice.getXis();
    for (int ip = 1; ip < fvs.size(); ++ip) {
      cache.resetQuick();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraintsMap.containsKey(fi)) {
          cache.add(constraintsMap.get(fi));
        }
      }
      for (int prev = 0; prev < map.getNumStates(); ++prev) {
        int liPrev = map.getLabelIndex(prev);
        if (liPrev != StateLabelMap.START_LABEL) {
          for (int curr = 0; curr < map.getNumStates(); ++curr) {
            int liCurr = map.getLabelIndex(curr);
            if (liCurr != StateLabelMap.START_LABEL) {
              double prob = Math.exp(xis[ip][prev][curr]);
              for (int j = 0; j < cache.size(); j++) {
                constraintsList.get(cache.getQuick(j)).expectation[liPrev][liCurr] += prob;
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:37,代码来源:TwoLabelGEConstraints.java


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