NumberColumn extends AbstractColumn<C, T> implements NumericColumn<T> { @Override public abstract C appendMissing(); protected  NumberColumn(final ColumnType type, final String name); NumberColumn<C, T> set(DoublePredicate condition, NumberColumn<C, T> other); NumberColumn<C, T> set(DoublePredicate condition, T newValue); void setPrintFormatter(final NumberFormat format, final String missingValueString); void setPrintFormatter(final NumberColumnFormatter formatter); abstract NumericColumn<T> top(final int n); abstract NumericColumn<T> bottom(final int n); @Override String getString(final int row); @Override C emptyCopy(); @Override C emptyCopy(final int rowSize); abstract C copy(); @Override IntComparator rowComparator(); @Override int byteSize(); @Override abstract byte[] asBytes(final int rowNumber); @Override abstract C appendMissing(); @Override int countMissing();  }
@Test public void testDoubleColumnAsStringWithMissing() { DoubleColumn numberColumn = DoubleColumn.create("test"); numberColumn.append(48392.2932); numberColumn.appendMissing(); StringColumn sc = numberColumn.asStringColumn(); assertEquals("test strings", sc.name()); assertEquals("48392.2932", sc.get(0)); assertEquals(StringColumnType.missingValueIndicator(), sc.get(1)); }
@Test public void testIntegerColumnAsStringWithMissing() { IntColumn numberColumn = IntColumn.create("test"); numberColumn.append(48392); numberColumn.appendMissing(); StringColumn sc = numberColumn.asStringColumn(); assertEquals("test strings", sc.name()); assertEquals("48392", sc.get(0)); assertEquals(StringColumnType.missingValueIndicator(), sc.get(1)); }
@Test public void testCountUniqueDouble() { DoubleColumn doubles = DoubleColumn.create("doubles"); doubles.append(1.0); doubles.append(1.0); doubles.append(2.0); doubles.appendMissing(); assertEquals(3, doubles.countUnique()); assertEquals(3, doubles.unique().size()); }
@Test public void testCountUniqueFloat() { FloatColumn floats = FloatColumn.create("floats"); floats.append(1f); floats.append(1f); floats.append(2f); floats.appendMissing(); assertEquals(3, floats.countUnique()); assertEquals(3, floats.unique().size()); }
@Test public void testCountUniqueInteger() { IntColumn ints = IntColumn.create("ints"); ints.append(1); ints.append(1); ints.append(2); ints.appendMissing(); assertEquals(3, ints.countUnique()); assertEquals(3, ints.unique().size()); }
@Test public void testCountUniqueLong() { LongColumn longs = LongColumn.create("longs"); longs.append(1L); longs.append(1L); longs.append(2L); longs.appendMissing(); assertEquals(3, longs.countUnique()); assertEquals(3, longs.unique().size()); }
@Test public void testCountUniqueShort() { ShortColumn shorts = ShortColumn.create("doubles"); shorts.append((short) 1); shorts.append((short) 1); shorts.append((short) 2); shorts.appendMissing(); assertEquals(3, shorts.countUnique()); assertEquals(3, shorts.unique().size()); }