use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class FilteredRowDataSetTest method testGetFilters.
@Test
public void testGetFilters() {
assertEquals(0, fdata.getFilters().length);
RangeFilter filter1 = new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS);
SortFilter filter2 = new SortFilter(2, SortFilter.ASCENDING);
fdata.addFilter(filter1);
fdata.addFilter(filter2);
IDataSetFilter[] filters = fdata.getFilters();
assertEquals(2, filters.length);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class FilteredRowDataSetTest method testClearFilters.
@Test
public void testClearFilters() {
data.remove(0);
data.remove(0);
RowEntry entry;
entry = new RowEntry();
entry.putRow(0, new Integer[] { 3, 2, 5 });
data.append(entry);
entry = new RowEntry();
entry.putRow(0, new Integer[] { 4, 2, 3 });
data.append(entry);
entry = new RowEntry();
entry.putRow(0, new Integer[] { 7, 2, 9 });
data.append(entry);
entry = new RowEntry();
entry.putRow(0, new Integer[] { 2, 2, 6 });
data.append(entry);
entry = new RowEntry();
entry.putRow(0, new Integer[] { 5, 2, 2 });
data.append(entry);
RangeFilter filter = new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS);
fdata.addFilter(filter);
fdata.addFilter(new SortFilter(2, SortFilter.ASCENDING));
fdata.clearFilters();
assertEquals(5, fdata.getRowCount());
Object[] row = fdata.getRow(0);
assertEquals(3, ((Integer) row[0]).intValue());
assertEquals(5, ((Integer) row[2]).intValue());
row = fdata.getRow(1);
assertEquals(4, ((Integer) row[0]).intValue());
assertEquals(3, ((Integer) row[2]).intValue());
}
use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testRemoveFilter.
@Test
public void testRemoveFilter() {
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);
RangeFilter filter = new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS);
dataSet.addFilter(filter);
dataSet.addFilter(new SortFilter(2, SortFilter.ASCENDING));
dataSet.removeFilter(filter);
assertEquals(1, dataSet.getRowCount());
Object[] row = dataSet.getRow(0);
assertEquals(5, ((Integer) row[0]).intValue());
assertEquals(2, ((Integer) row[2]).intValue());
}
use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class RangeFilterTest method testRangeFilter.
@Test
public void testRangeFilter() {
RangeFilter filter = new RangeFilter(-1, 3, 5, RangeFilter.INSIDE_BOUNDS);
assertNotNull(filter);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter in project linuxtools by eclipse.
the class RangeFilterTest method testUnboundedFilters.
@Test
public void testUnboundedFilters() {
int width = 4;
int height = 10;
int wrap = height / 3;
ArrayList<Object>[] data = MockDataSet.buildArray(width, height, wrap);
filter = new RangeFilter(1, 1, null, RangeFilter.INCLUSIVE);
List<Object>[] data2 = filter.filter(data);
assertEquals(width, data.length);
assertEquals(height, data[1].size());
assertEquals(width, data2.length);
assertEquals(7, data2[1].size());
assertEquals("1", data2[1].get(0));
assertEquals("2", data2[1].get(1));
assertEquals("1", data2[1].get(2));
assertEquals("2", data2[1].get(3));
assertEquals(data[2].get(0), data2[2].get(0));
assertEquals(data[2].get(1), data2[2].get(1));
assertEquals(data[2].get(3), data2[2].get(2));
assertEquals(data[2].get(4), data2[2].get(3));
filter = new RangeFilter(1, 1, null, 0);
data2 = filter.filter(data);
assertEquals(width, data.length);
assertEquals(height, data[1].size());
assertEquals(width, data2.length);
assertEquals(3, data2[1].size());
assertEquals("2", data2[1].get(0));
assertEquals("2", data2[1].get(1));
assertEquals("2", data2[1].get(2));
assertEquals(data[2].get(1), data2[2].get(0));
assertEquals(data[2].get(4), data2[2].get(1));
assertEquals(data[2].get(7), data2[2].get(2));
filter = new RangeFilter(1, null, 1, RangeFilter.INCLUSIVE);
data2 = filter.filter(data);
assertEquals(width, data.length);
assertEquals(height, data[1].size());
assertEquals(width, data2.length);
assertEquals(7, data2[1].size());
assertEquals("1", data2[1].get(0));
assertEquals("0", data2[1].get(1));
assertEquals("1", data2[1].get(2));
assertEquals("0", data2[1].get(3));
assertEquals(data[2].get(0), data2[2].get(0));
assertEquals(data[2].get(2), data2[2].get(1));
assertEquals(data[2].get(3), data2[2].get(2));
assertEquals(data[2].get(5), data2[2].get(3));
filter = new RangeFilter(1, null, 1, 0);
data2 = filter.filter(data);
assertEquals(width, data.length);
assertEquals(height, data[1].size());
assertEquals(width, data2.length);
assertEquals(3, data2[1].size());
assertEquals("0", data2[1].get(0));
assertEquals("0", data2[1].get(1));
assertEquals("0", data2[1].get(2));
assertEquals(data[2].get(2), data2[2].get(0));
assertEquals(data[2].get(5), data2[2].get(1));
assertEquals(data[2].get(8), data2[2].get(2));
}
Aggregations