AbstractColumn implements Column<T> { @Override @SuppressWarnings({"unchecked", "rawtypes"}) public C set(Selection condition, Column<T> other) { return (C) Column.super.set(condition, other); } AbstractColumn(ColumnType type, final String name); @Override String name(); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C setName(final String name); @Override ColumnType type(); @Override abstract Column<T> emptyCopy(); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C filter(Predicate<? super T> test); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C sorted(Comparator<? super T> comp); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C map(Function<? super T, ? extends T> fun); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C min(Column<T> other); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C max(Column<T> other); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C set(Selection condition, Column<T> other); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C set(Selection rowSelection, T newValue); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C first(int numRows); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C last(int numRows); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C sampleN(int n); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C sampleX(double proportion); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C subset(int[] rows); @Override @SuppressWarnings({"unchecked", "rawtypes"}) C inRange(int start, int end); @Override String toString(); @Override StringColumn asStringColumn(); @Override int indexOf(final Object o); static final int DEFAULT_ARRAY_SIZE; }
@Test public void fillMissing_defaultValue() { DoubleColumn col1 = DoubleColumn.create( "col1", new double[] { 0.0, 1.0, DoubleColumnType.missingValueIndicator(), 2.0, DoubleColumnType.missingValueIndicator() }); DoubleColumn expected = DoubleColumn.create("expected", new double[] {0.0, 1.0, 7.0, 2.0, 7.0}); assertArrayEquals( expected.asDoubleArray(), col1.set(col1.isMissing(), 7.0).asDoubleArray(), 0.0001); }
@Test public void fillMissing_columnArg() { DoubleColumn col1 = DoubleColumn.create( "col1", new double[] { 0.0, 1.0, DoubleColumnType.missingValueIndicator(), 2.0, DoubleColumnType.missingValueIndicator() }); DoubleColumn col2 = DoubleColumn.create("col1", new double[] {7.0, 7.0, 3.0, 7.0, 4.0}); DoubleColumn expected = DoubleColumn.create("expected", new double[] {0.0, 1.0, 3.0, 2.0, 4.0}); assertArrayEquals( expected.asDoubleArray(), col1.set(col1.isMissing(), col2).asDoubleArray(), 0.0001); }