@Override public int getKeyForIndex(int rowIndex) { return values.getShort(rowIndex); }
public short getShort(int index) { return data.getShort(index); }
/** * Returns the value at the given index. The actual value is returned if the ColumnType is INTEGER * * Returns the closest {@code int} to the argument, with ties * rounding to positive infinity. * * <p> * Special cases: * <p> * Special cases: * <ul> * <li>If the argument is NaN, the result is 0. * <li>If the argument is positive infinity or any value greater than or * equal to the value of {@code Integer.MAX_VALUE}, an error will be thrown * </ul> * * @param row the index of the value to be rounded to an integer. * @return the value of the argument rounded to the nearest * {@code int} value. * @throws ClassCastException if the absolute value of the value to be rounded is too large to be cast to an int */ public int getInt(int row) { return data.getShort(row); }
@Override public String getValueForIndex(int rowIndex) { short k = values.getShort(rowIndex); return getValueForKey(k); }
@Override public double getDouble(int row) { short value = data.getShort(row); if (isMissingValue(value)) { return DoubleColumnType.missingValueIndicator(); } return value; }
@Override public Selection selectIsIn(Collection<String> strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.size()); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }
@Override public Selection selectIsIn(String... strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.length); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }
@Override public float getFloat(int index) { return (float) data.getShort(index); }
@Override public int getKeyForIndex(int rowIndex) { return values.getShort(rowIndex); }
public short get(int index) { return data.getShort(index); }
public short getShort(int index) { return data.getShort(index); }
@Override public String getString(int row) { return String.valueOf(data.getShort(row)); }
@Override public String getValueForIndex(int rowIndex) { short k = values.getShort(rowIndex); return getValueForKey(k); }
public int[] toIntArray() { int[] output = new int[data.size()]; for (int i = 0; i < data.size(); i++) { output[i] = data.getShort(i); } return output; } }
public double[] toDoubleArray() { double[] output = new double[data.size()]; for (int i = 0; i < data.size(); i++) { output[i] = data.getShort(i); } return output; }
@Override public double getDouble(int row) { short value = data.getShort(row); if (isMissingValue(value)) { return DoubleColumnType.missingValueIndicator(); } return value; }
public void remove() { if (last == -1) throw new IllegalStateException(); if (last == n) { containsNullKey = false; } else if (pos >= 0) shiftKeys(last); else { // We're removing wrapped entries. Short2BooleanOpenCustomHashMap.this.remove(wrapped.getShort(-pos - 1)); last = -1; // Note that we must not decrement size return; } size--; last = -1; // You can no longer remove this entry. if (ASSERTS) checkTable(); } public int skip(final int n) {
public Selection select(ShortBiPredicate predicate, int valueToCompareAgainst) { Selection bitmap = new BitmapBackedSelection(); for (int idx = 0; idx < data.size(); idx++) { short next = data.getShort(idx); if (predicate.test(next, valueToCompareAgainst)) { bitmap.add(idx); } } return bitmap; }
public Selection select(ShortPredicate predicate) { Selection bitmap = new BitmapBackedSelection(); for (int idx = 0; idx < data.size(); idx++) { short next = data.getShort(idx); if (predicate.test(next)) { bitmap.add(idx); } } return bitmap; }
@Override public Selection selectIsIn(Collection<String> strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.size()); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }