@Override public boolean addAll(IntList l) { synchronized (sync) { return list.addAll(l); } } /**
@Override public boolean addAll(Collection<? extends Integer> c) { return list.addAll(c); } @Override
@Override public boolean addAll(final int index, IntList l) { synchronized (sync) { return list.addAll(index, l); } } @Override
@Override public boolean addAll(IntBigList c) { return list.addAll(c); } @Override
@Override public boolean addAll(final int index, final Collection<? extends Integer> c) { synchronized (sync) { return list.addAll(index, c); } } @Override
@Override public boolean addAll(final int index, final IntCollection c) { synchronized (sync) { return list.addAll(index, c); } } @Override
@Override public boolean addAll(IntCollection c) { return list.addAll(c); } @Override
@Override public BinaryOperator<IntList> combiner() { return (list1, list2) -> { list1.addAll(list2); return list1; }; }
public void addAll(IntCollection pos) { mapping.addAll(pos); }
@Override public boolean addAll(final int index, final Collection<? extends Integer> c) { ensureIndex(index); to += c.size(); return l.addAll(from + index, c); } @Override
@Override public boolean addAll(long index, IntCollection c) { return list.addAll(intIndex(index), c); } @Override
@Override public boolean addAll(final long index, final Collection<? extends Integer> c) { return list.addAll(intIndex(index), c); } @Override
@Override public boolean addAll(long index, IntBigList c) { return list.addAll(intIndex(index), c); } @Override
private static List<IntList> buildStrata(Frame df, int folds, String classColName) { List<String> dict = df.rvar(classColName).levels(); List<IntList> rows = new ArrayList<>(); for (int i = 0; i < dict.size(); i++) { rows.add(new IntArrayList()); } for (int i = 0; i < df.rowCount(); i++) { rows.get(df.getInt(i, classColName)).add(i); } IntList shuffle = new IntArrayList(); for (int i = 0; i < dict.size(); i++) { Collections.shuffle(rows.get(i), RandomSource.getRandom()); shuffle.addAll(rows.get(i)); } List<IntList> strata = new ArrayList<>(); for (int i = 0; i < folds; i++) { strata.add(new IntArrayList()); } int fold = 0; for (int next : shuffle) { strata.get(fold).add(next); fold++; if (fold == folds) { fold = 0; } } return strata; }
boolean full = false; if (headRows + tailRows > aggregateDf.rowCount()) { selectedGroupIds.addAll(sortedGroupIds); full = true; } else { selectedGroupIds.addAll(sortedGroupIds.subList(0, headRows)); selectedGroupIds.addAll(sortedGroupIds.subList(sortedGroupIds.size() - tailRows, sortedGroupIds.size()));
/** * Given a table, generate the Next K items in Sorted Order starting from a specified * rowSnapShot (topRow), together with counts. * @param data The input table on which we want to compute the NextK list. * @return A NextKList. */ public NextKList create(@Nullable ITable data) { IndexComparator comp = this.recordOrder.getIndexComparator(Converters.checkNull(data)); IntTopK topK = new IntTreeTopK(this.maxSize, comp); IRowIterator rowIt = data.getRowIterator(); int position = 0; Schema toBring = this.recordOrder.toSchema(); VirtualRowSnapshot vw = new VirtualRowSnapshot(data, toBring); for (int i = rowIt.getNextRow(); i >= 0; i = rowIt.getNextRow()) { vw.setRow(i); if ((this.topRow == null) || (this.topRow.compareTo(vw, this.recordOrder) <= 0)) topK.push(i); else position++; } Int2IntSortedMap topKList = topK.getTopK(); IRowOrder rowOrder = new ArrayRowOrder(topKList.keySet().toIntArray()); SmallTable topKRows = data.compress(this.recordOrder.toSchema(), rowOrder); IntList count = new IntArrayList(topKList.size()); count.addAll(topKList.values()); return new NextKList(topKRows, count, position, data.getNumOfRows()); }