@Test public void filterRowNumber() { VTable table1 = newVTable(column("Rack", newVStringArray(Arrays.asList("A", "A", "B"), alarmNone(), timeNow())), column("Slot", newVDoubleArray(new ArrayDouble(1,2,3), alarmNone(), timeNow(), displayNone())), column("CPU", newVStringArray(Arrays.asList("286", "286", "386"), alarmNone(), timeNow()))); ValueFilter valueFilter = new ValueFilter(table1, "Slot", ValueFactory.toVType(2)); assertThat(valueFilter.filterRow(0), equalTo(false)); assertThat(valueFilter.filterRow(1), equalTo(true)); assertThat(valueFilter.filterRow(2), equalTo(false)); }
public boolean filterRow(int rowIndex) { if (value instanceof VNumber) { double columnValue = ((ListNumber) table.getColumnData(columnIndex)).getDouble(rowIndex); return columnValue == ((VNumber) value).getValue().doubleValue(); } else if (value instanceof VString) { @SuppressWarnings("unchecked") List<String> columnData = (List<String>) table.getColumnData(columnIndex); return Objects.equals(columnData.get(rowIndex), ((VString) value).getValue()); } throw new IllegalStateException("Unexpected error"); }
ValueFilter { public boolean filterRow(int rowIndex) { if (value instanceof VNumber) { double columnValue = ((ListNumber) table.getColumnData(columnIndex)).getDouble(rowIndex); return columnValue == ((VNumber) value).getValue().doubleValue(); } else if (value instanceof VString) { @SuppressWarnings("unchecked") List<String> columnData = (List<String>) table.getColumnData(columnIndex); return Objects.equals(columnData.get(rowIndex), ((VString) value).getValue()); } throw new IllegalStateException("Unexpected error"); } }
ValueFilter { public boolean filterRow(int rowIndex) { if (value instanceof VNumber) { double columnValue = ((ListNumber) table.getColumnData(columnIndex)).getDouble(rowIndex); return columnValue == ((VNumber) value).getValue().doubleValue(); } else if (value instanceof VString) { @SuppressWarnings("unchecked") List<String> columnData = (List<String>) table.getColumnData(columnIndex); return Objects.equals(columnData.get(rowIndex), ((VString) value).getValue()); } throw new IllegalStateException("Unexpected error"); } ValueFilter(VTable table, String columnName, Object value); }
ValueFilter { public boolean filterRow(int rowIndex) { if (value instanceof VNumber) { double columnValue = ((ListNumber) table.getColumnData(columnIndex)).getDouble(rowIndex); return columnValue == ((VNumber) value).getValue().doubleValue(); } else if (value instanceof VString) { @SuppressWarnings("unchecked") List<String> columnData = (List<String>) table.getColumnData(columnIndex); return Objects.equals(columnData.get(rowIndex), ((VString) value).getValue()); } throw new IllegalStateException("Unexpected error"); } ValueFilter(VTable table, String columnName, Object value); boolean filterRow(int rowIndex); }
ValueFilter { public boolean filterRow(int rowIndex) { if (value instanceof VNumber) { double columnValue = ((ListNumber) table.getColumnData(columnIndex)).getDouble(rowIndex); return columnValue == ((VNumber) value).getValue().doubleValue(); } else if (value instanceof VString) { @SuppressWarnings("unchecked") List<String> columnData = (List<String>) table.getColumnData(columnIndex); return Objects.equals(columnData.get(rowIndex), ((VString) value).getValue()); } throw new IllegalStateException("Unexpected error"); } ValueFilter(VTable table, String columnName, Object value); boolean filterRow(int rowIndex);  }