gnu.trove.TIntArrayList.add()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中gnu.trove.TIntArrayList.add()方法的一些代码示例,展示了TIntArrayList.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TIntArrayList.add()方法的具体详情如下:
包路径:gnu.trove.TIntArrayList
类名称:TIntArrayList
方法名:add

TIntArrayList.add介绍

[英]See gnu.trove.list.array.TIntArrayList#add(int)
[中]见gnu。宝藏。列表大堆TIntArrayList#添加(int)

代码示例

代码示例来源:origin: JetBrains/ideavim

private static void addNavigationElements(@NotNull TreeElement root, @NotNull TIntArrayList navigationOffsets, boolean start) {
 if (root instanceof PsiTreeElementBase) {
  PsiElement element = ((PsiTreeElementBase)root).getValue();
  int offset;
  if (start) {
   offset = element.getTextRange().getStartOffset();
   if (element.getLanguage().getID().equals("JAVA")) {
    // HACK: for Java classes and methods, we want to jump to the opening brace
    int textOffset = element.getTextOffset();
    int braceIndex = element.getText().indexOf('{', textOffset - offset);
    if (braceIndex >= 0) {
     offset += braceIndex;
    }
   }
  }
  else {
   offset = element.getTextRange().getEndOffset() - 1;
  }
  if (!navigationOffsets.contains(offset)) {
   navigationOffsets.add(offset);
  }
 }
 for (TreeElement child : root.getChildren()) {
  addNavigationElements(child, navigationOffsets, start);
 }
}

代码示例来源:origin: de.julielab/jcore-mallet-0.4

private void readObject(ObjectInputStream stream)
  throws IOException, ClassNotFoundException {
  stream.defaultReadObject();
  int size = stream.readInt();
  _data = new int[size];
  while (size-- > 0) {
    int val = stream.readInt();
    add(val);
  }
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common

public static int[] getSelectedIdx(final BitSet _set) {
 if (_set == null || _set.isEmpty()) { return FuEmptyArrays.INT0; }
 final int max = _set.length();
 final TIntArrayList list = new TIntArrayList(max);
 for (int i = 0; i < max; i++) {
  if (_set.get(i)) {
   list.add(i);
  }
 }
 return list.toNativeArray();
}

代码示例来源:origin: cc.mallet/mallet

public ListVarSet (Universe universe, Collection included)
{
 this.universe = universe;
 this.included = new TIntArrayList (included.size ());
 java.util.Iterator it = included.iterator();
 while (it.hasNext()) {
  this.included.add (universe.getIndex ((Variable) it.next ()));
 }
 this.included.sort ();
}

代码示例来源:origin: cc.mallet/mallet

public boolean add (Object o)
{
 int idx = universe.getIndex ((Variable) o);
 if (idx == -1)
  throw new UnsupportedOperationException();
 included.add (idx);
 included.sort ();
 return true;
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public ListVarSet (Universe universe, Collection included)
{
 this.universe = universe;
 this.included = new TIntArrayList (included.size ());
 java.util.Iterator it = included.iterator();
 while (it.hasNext()) {
  this.included.add (universe.getIndex ((Variable) it.next ()));
 }
 this.included.sort ();
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public boolean add (Object o)
{
 int idx = universe.getIndex ((Variable) o);
 if (idx == -1)
  throw new UnsupportedOperationException();
 included.add (idx);
 included.sort ();
 return true;
}

代码示例来源:origin: cc.mallet/mallet

private void fillUnclusteredInstances (int size) {
  unclusteredInstances = new TIntArrayList(size);
  for (int i = 0; i < size; i++)
    unclusteredInstances.add(i);
  unclusteredInstances.shuffle(random);
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

private void fillUnclusteredInstances (int size) {
  unclusteredInstances = new TIntArrayList(size);
  for (int i = 0; i < size; i++)
    unclusteredInstances.add(i);
  unclusteredInstances.shuffle(random);
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common

public final void initWith(final CtuluArrayInteger _m, final boolean _throwEvent) {
 list_ = new TIntArrayList(_m.list_.length);
 list_.add(_m.list_);
 if (_throwEvent) {
  fireIntStructureChanged();
 }
}

代码示例来源:origin: de.julielab/jcore-mallet-0.4

public Object create() {
    TIntArrayList list = new TIntArrayList();
    for (int i = 0; i < 1000; i++) {
      list.add(i);
    }
    list.trimToSize();
    return list;
  }
}

代码示例来源:origin: net.sourceforge.mstparser/mstparser

private void addKeysToList(TIntArrayList keys) {
 if (null != subfv1) {
  subfv1.addKeysToList(keys);
  if (null != subfv2)
   subfv2.addKeysToList(keys);
 }
 ListIterator it = listIterator();
 while (it.hasNext())
  keys.add(((Feature) it.next()).index);
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-gis

public GISAttributeModelIntegerInterface deriveNewModel(final int _numObject,
  final GISReprojectInterpolateurI.IntegerTarget _interpol) {
 final TIntArrayList newList = new TIntArrayList(_numObject);
 for (int i = 0; i < _numObject; i++) {
  newList.add(_interpol.interpol(i));
 }
 return new GISAttributeModelIntegerList(newList, this);
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-gis

public GISAttributeModel createSubModel(final int[] _idxToRemove) {
 final  TIntArrayList newList = new TIntArrayList(getSize());
 final int nb = getSize();
 for (int i = 0; i < nb; i++) {
  if (Arrays.binarySearch(_idxToRemove, i) < 0) {
   newList.add(list_.get(i));
  }
 }
 return new GISAttributeModelIntegerList(newList, this);
}

代码示例来源:origin: cc.mallet/mallet

public void preProcess(FeatureVector fv) {
 cache.resetQuick();
 int fi;
 // cache constrained input features
 for (int loc = 0; loc < fv.numLocations(); loc++) {
  fi = fv.indexAtLocation(loc);
  if (constraints.containsKey(fi)) {
   cache.add(fi);
  }
 }
}

代码示例来源:origin: cc.mallet/mallet

public void preProcess(FeatureVector fv) {
 cache.resetQuick();
 int fi;
 // cache constrained input features
 for (int loc = 0; loc < fv.numLocations(); loc++) {
  fi = fv.indexAtLocation(loc);
  if (constraints.containsKey(fi)) {
   cache.add(fi);
  }
 }
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public void preProcess(FeatureVector fv) {
 cache.resetQuick();
 int fi;
 // cache constrained input features
 for (int loc = 0; loc < fv.numLocations(); loc++) {
  fi = fv.indexAtLocation(loc);
  if (constraints.containsKey(fi)) {
   cache.add(fi);
  }
 }
}

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

public void preProcess(FeatureVector fv) {
 cache.resetQuick();
 int fi;
 // cache constrained input features
 for (int loc = 0; loc < fv.numLocations(); loc++) {
  fi = fv.indexAtLocation(loc);
  if (constraints.containsKey(fi)) {
   cache.add(fi);
  }
 }
}

代码示例来源:origin: com.github.steveash.mallet/mallet

public void preProcess(FeatureVector fv) {
 cache.resetQuick();
 int fi;
 for (int loc = 0; loc < fv.numLocations(); loc++) {
  fi = fv.indexAtLocation(loc);
  if (constraintsMap.containsKey(fi)) {
   cache.add(constraintsMap.get(fi));
  }
 }
}

代码示例来源:origin: com.github.steveash.mallet/mallet

private int[] toValueArray ()
{
 TIntArrayList vals = new TIntArrayList (maxTime () * numSlices ());
 for (int t = 0; t < lblseq.size (); t++) {
  Labels lbls = lblseq.getLabels (t);
  for (int j = 0; j < lbls.size (); j++) {
   Label lbl = lbls.get (j);
   vals.add (lbl.getIndex ());
  }
 }
 return vals.toNativeArray ();
}

相关文章