use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testClearFilters.
@Test
public void testClearFilters() {
TableEntry entry;
entry = new TableEntry();
entry.add(new Integer[] { 3, 2, 5 });
dataSet.append(entry);
entry = new TableEntry();
entry.add(new Integer[] { 4, 2, 3 });
dataSet.append(entry);
entry = new TableEntry();
entry.add(new Integer[] { 7, 2, 9 });
dataSet.append(entry);
entry = new TableEntry();
entry.add(new Integer[] { 2, 2, 6 });
dataSet.append(entry);
entry = new TableEntry();
entry.add(new Integer[] { 5, 2, 2 });
dataSet.append(entry);
dataSet.addFilter(new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS));
dataSet.addFilter(new SortFilter(2, SortFilter.ASCENDING));
assertEquals(2, dataSet.getFilters().length);
dataSet.clearFilters();
assertEquals(1, dataSet.getRowCount());
Object[] row = dataSet.getRow(0);
assertEquals(5, ((Integer) row[0]).intValue());
assertEquals(2, ((Integer) row[2]).intValue());
assertEquals(0, dataSet.getFilters().length);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class RangeFilterWizardPage method createFilter.
@Override
protected void createFilter() {
filter = null;
setErrorMessage(null);
String highText = txtHigh.getText().trim();
String lowText = txtLow.getText().trim();
// Allow inside/outside bounds only if the range is bounded (has upper & lower bounds)
boolean bounded = highText.length() * lowText.length() != 0;
radInside.setEnabled(bounded);
radOutside.setEnabled(bounded);
if (highText.length() + lowText.length() == 0) {
// $NON-NLS-1$
setErrorMessage(Localization.getString("RangeFilterWizardPage.EmptyError"));
return;
}
try {
Double high = highText.length() > 0 ? Double.parseDouble(txtHigh.getText().trim()) : null;
Double low = lowText.length() > 0 ? Double.parseDouble(txtLow.getText().trim()) : null;
if (low != null && high != null && low >= high) {
// $NON-NLS-1$
setErrorMessage(Localization.getString("RangeFilterWizardPage.BoundError"));
return;
}
// By default, if range is unbounded, force "inside" bounds to apply.
int style = (!radInside.isEnabled() || radInside.getSelection() ? RangeFilter.INSIDE_BOUNDS : RangeFilter.OUTSIDE_BOUNDS);
int selected = cboColumn.getSelectionIndex();
if (chkInclusive.getSelection()) {
style |= RangeFilter.INCLUSIVE;
}
filter = new RangeFilter(selected, low, high, style);
} catch (NumberFormatException nfe) {
}
}
Aggregations