@Override public void sortDescending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, reverseDictionarySortComparator); this.values = new ByteArrayList(elements); }
@Override public int countUnique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } return count.size(); }
@Override public BooleanColumn unique() { ByteSet count = new ByteOpenHashSet(3); for (byte next : data) { count.add(next); } ByteArrayList list = new ByteArrayList(count); return new BooleanColumn(name() + " Unique values", list); }
/** * 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(); }
@Override public String getValueForKey(int key) { return keyToValue.get((byte) key); }
/** * 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); }
@Override public void clear() { data.clear(); }
/** * Returns {@code true} if the iteration has more elements. * (In other words, returns {@code true} if {@link #next} would * return an element rather than throwing an exception.) * * @return {@code true} if the iteration has more elements */ @Override public boolean hasNext() { return iterator.hasNext(); }
@Override public boolean isEmpty() { return data.isEmpty(); }
/** * Returns a byteListIterator, which allows iteration by byte (value) and int (index) */ private ByteListIterator byteListIterator() { return data.iterator(); }
@Override public void sortAscending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, dictionarySortComparator); this.values = new ByteArrayList(elements); }
@Override public int size() { return data.size(); }
@Override public int getKeyForIndex(int rowIndex) { return values.getByte(rowIndex); }
public BooleanColumn append(byte b) { data.add(b); return this; }