@Override public void sortDescending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, reverseDictionarySortComparator); this.values = new ByteArrayList(elements); }
wrapped = new ByteArrayList(2); wrapped.add(key[pos]);
public static BooleanColumn create(String name) { return new BooleanColumn(name, new ByteArrayList(DEFAULT_ARRAY_SIZE)); }
ByteArrayList postingList = new ByteArrayList(); // list of postings for a new (k+1) sequence PostingList.Decompressor leftPostingList = new PostingList.Decompressor(); // posting list of the left k-sequence PostingList.Decompressor rightPostingList = new PostingList.Decompressor(); // posting list of the right k-sequence postingList.clear(); leftPostingList.offset = 0; rightPostingList.postingList = kPostingLists.get(rightSequences.get(j)); if (postingList.size() > 0) { PostingList.addCompressed(0, postingList); // add separator byte ByteArrayList temp = new ByteArrayList(postingList.size()); // copying necessary here; postingList reused for (int k = 0; k < postingList.size(); k++) { temp.add(postingList.get(k)); // bad API here; newer Trove versions support this directly
public BooleanColumn(String name, Selection hits, int columnSize) { super(name); if (columnSize == 0) { return; } ByteArrayList data = new ByteArrayList(columnSize); for (int i = 0; i < columnSize; i++) { data.add((byte) 0); } IntIterator intIterator = hits.iterator(); while (intIterator.hasNext()) { byte b = (byte) 1; int i = intIterator.next(); data.set(i, b); } this.data = data; }
/** * Returns the number of elements (a.k.a. rows or cells) in the column * * @return size as int */ @Override public int size() { return values.size(); }
private int addBlock(ObjectArrayList<AlignmentBlock> blocks, int start, ByteArrayList bases, ByteArrayList scores) { blocks.add( new AlignmentBlockImpl(start, bases.toByteArray(new byte[bases.size()]), scores.toByteArray(new byte[scores.size()]))); start += bases.size(); bases.clear(); scores.clear(); return start; }
@Override public void setTag(String k, @Nullable NBTBase base) { int id = Integer.parseInt(k); if (id == -1) { if (base != null) { list.add(((NBTPrimitive) base).getByte()); } } else if (base != null) { list.set(id, ((NBTPrimitive) base).getByte()); } else { list.rem(id); } if (parent != null) { parent.setTag(key, new NBTTagByteArray(list.toByteArray())); } }
ByteArrayList bases = new ByteArrayList(); ByteArrayList scores = new ByteArrayList(); int readLength = alignmentEntry.getQueryLength(); bases.clear(); scores.clear(); for (int i = 0; i < sequenceVariationLength; i++) { final char toChar = i >= toLength ? '-' : to.charAt(i); bases.add((byte) toChar); scores.add(qual); deletedBases++; bases.clear(); scores.clear(); } else if (!to.contains("-")) { for (int i = 0; i < toLength; i++) { int matchLength = alignmentEntry.getQueryAlignedLength() - deletedBases; int endAlignmentRefPosition = matchLength + start; bases.clear(); scores.clear(); int maxIndex = Math.min(readBases.length, readQual.length); while (pos < endAlignmentRefPosition) { final int index = pos - start + leftPadding; if (index < maxIndex) { bases.add(readBases[index]); scores.add(readQual[index]); } else {
/** * Returns the value in row i as a byte (0, 1, or Byte.MIN_VALUE representing missing data) * * @param i the row number */ public byte getByte(int i) { return data.getByte(i); }
/** * Pours an iterator, returning a type-specific list, with a limit on the number * of elements. * * <p> * This method iterates over the given type-specific iterator and returns a * type-specific list containing the returned elements (up to {@code max}). * Iteration on the returned list is guaranteed to produce the elements in the * same order in which they appeared in the iterator. * * * @param i * a type-specific iterator. * @param max * the maximum number of elements to be poured. * @return a type-specific list containing the returned elements, up to * {@code max}. */ public static ByteList pour(final ByteIterator i, int max) { final ByteArrayList l = new ByteArrayList(); pour(i, l, max); l.trim(); return l; } /**
@Override public void clear() { data.clear(); }
private void serializeList(final DataOutput out, final List list) throws IOException { Class oCls = list.getClass(); if (oCls.equals(IntArrayList.class)) { serialize(out, ((IntArrayList) list).toIntArray()); } else if (oCls.equals(FloatArrayList.class)) { serialize(out, ((FloatArrayList) list).toFloatArray()); } else if (oCls.equals(DoubleArrayList.class)) { serialize(out, ((DoubleArrayList) list).toDoubleArray()); } else if (oCls.equals(ShortArrayList.class)) { serialize(out, ((ShortArrayList) list).toShortArray()); } else if (oCls.equals(ByteArrayList.class)) { serialize(out, ((ByteArrayList) list).toByteArray()); } else if (oCls.equals(LongArrayList.class)) { serialize(out, ((LongArrayList) list).toLongArray()); } else if (oCls.equals(BooleanArrayList.class)) { serialize(out, ((BooleanArrayList) list).toBooleanArray()); } else if (oCls.equals(CharArrayList.class)) { serialize(out, ((CharArrayList) list).toCharArray()); } else { serialize(out, list.size()); for (Object obj : list) { serialize(out, obj); } } }
@Override public void sortDescending() { ByteArrays.mergeSort(data.elements(), descendingByteComparator); }