public static BooleanColumn create(String name) { return new BooleanColumn(name, new ByteArrayList(DEFAULT_ARRAY_SIZE)); }
public static BooleanColumn create(String name, int initialSize) { BooleanColumn column = new BooleanColumn(name, new ByteArrayList(initialSize)); for (int i = 0; i < initialSize; i++) { column.appendMissing(); } return column; } public static BooleanColumn create(String name, boolean[] values) {
@Override public void sortDescending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, reverseDictionarySortComparator); this.values = new ByteArrayList(elements); }
@Override public void sortAscending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, dictionarySortComparator); this.values = new ByteArrayList(elements); }
@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); }
@Override public BooleanColumn lag(int n) { int srcPos = n >= 0 ? 0 : 0 - n; byte[] dest = new byte[size()]; int destPos = n <= 0 ? 0 : n; int length = n >= 0 ? size() - n : size() + n; for (int i = 0; i < size(); i++) { dest[i] = BooleanColumnType.MISSING_VALUE; } System.arraycopy(data.toByteArray(), srcPos, dest, destPos, length); BooleanColumn copy = emptyCopy(size()); copy.data = new ByteArrayList(dest); copy.setName(name() + " lag(" + n + ")"); return copy; }
public BooleanColumn(String name, int initialSize) { super(name); data = new ByteArrayList(initialSize); }
public BooleanColumn(ColumnMetadata metadata) { super(metadata); data = new ByteArrayList(DEFAULT_ARRAY_SIZE); }
private BooleanColumn(String name) { super(name); data = new ByteArrayList(DEFAULT_ARRAY_SIZE); }
@Override public ByteArrayList clone() { ByteArrayList c = new ByteArrayList(size); System.arraycopy(a, 0, c.a, 0, size); c.size = size; return c; } /**
public static BooleanColumn create(String name) { return new BooleanColumn(name, new ByteArrayList(DEFAULT_ARRAY_SIZE)); }
/** * Wraps a given array into an array list of given size. * * <p> * Note it is guaranteed that the type of the array returned by * {@link #elements()} will be the same (see the comments in the class * documentation). * * @param a * an array to wrap. * @param length * the length of the resulting array list. * @return a new array list of the given size, wrapping the given array. */ public static ByteArrayList wrap(final byte a[], final int length) { if (length > a.length) throw new IllegalArgumentException( "The specified length (" + length + ") is greater than the array size (" + a.length + ")"); final ByteArrayList l = new ByteArrayList(a, false); l.size = length; return l; } /**
public ButtonNBTByteArray(Panel panel, ButtonNBTCollection p, String key, NBTTagByteArray l) { super(panel, p, key, NBT_BYTE_ARRAY_OPEN, NBT_BYTE_ARRAY_CLOSED); list = new ByteArrayList(l.getByteArray()); }
public static BooleanColumn create(String name, int initialSize) { BooleanColumn column = new BooleanColumn(name, new ByteArrayList(initialSize)); for (int i = 0; i < initialSize; i++) { column.appendMissing(); } return column; } public static BooleanColumn create(String name, boolean[] values) {
@Override public void sortAscending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, dictionarySortComparator); this.values = new ByteArrayList(elements); }
@Override public void sortDescending() { byte[] elements = values.toByteArray(); ByteArrays.parallelQuickSort(elements, reverseDictionarySortComparator); this.values = new ByteArrayList(elements); }
@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); }
@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); }
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; }
@Override public BooleanColumn lag(int n) { int srcPos = n >= 0 ? 0 : 0 - n; byte[] dest = new byte[size()]; int destPos = n <= 0 ? 0 : n; int length = n >= 0 ? size() - n : size() + n; for (int i = 0; i < size(); i++) { dest[i] = BooleanColumnType.MISSING_VALUE; } System.arraycopy(data.toByteArray(), srcPos, dest, destPos, length); BooleanColumn copy = emptyCopy(size()); copy.data = new ByteArrayList(dest); copy.setName(name() + " lag(" + n + ")"); return copy; }