use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.table.TableEntry in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testAddFilter.
@Test
public void testAddFilter() {
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, 4, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS));
assertEquals(0, dataSet.getRowCount());
dataSet.clearFilters();
dataSet.addFilter(new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS));
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.datasets.table.TableEntry in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testGetHistoricalData.
// End overwrite methods to insure data is removed from the original DataSet
@Test
public void testGetHistoricalData() {
TableEntry entry = new TableEntry();
entry.putRow(0, new String[] { "1", "2", "3" });
dataSet.setData(entry);
entry = new TableEntry();
entry.putRow(0, new String[] { "4", "5", "6" });
dataSet.setData(entry);
assertNull(dataSet.getHistoricalData(null, -3));
assertNull(dataSet.getHistoricalData(null, 10));
assertNull(dataSet.getHistoricalData(null, -3, 0, 1));
assertNull(dataSet.getHistoricalData(null, 10, 0, 1));
assertNull(dataSet.getHistoricalData(null, 1, 3, 1));
assertNull(dataSet.getHistoricalData(null, 1, -2, 1));
assertNull(dataSet.getHistoricalData(null, 1, 0, 20));
Object[] col = dataSet.getHistoricalData(null, 0);
assertEquals(2, col.length);
assertEquals("0", col[0].toString());
assertEquals("0", col[1].toString());
col = dataSet.getHistoricalData(null, IDataSet.COL_ROW_NUM);
assertEquals(2, col.length);
assertEquals("1", col[0].toString());
assertEquals("2", col[1].toString());
col = dataSet.getHistoricalData("4", 1, 1, 2);
assertEquals(1, col.length);
assertSame("5", col[0]);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.table.TableEntry in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testAppend.
@Test
public void testAppend() {
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);
Object[] row = dataSet.getRow(0);
assertEquals(5, ((Integer) row[0]).intValue());
assertEquals(2, ((Integer) row[2]).intValue());
assertNull(dataSet.getRow(2));
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.table.TableEntry in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testRemove.
@Test
public void testRemove() {
assertFalse(dataSet.remove(null));
assertFalse(dataSet.remove(new RowEntry()));
assertFalse(dataSet.remove(-1));
assertFalse(dataSet.remove(10));
assertEquals(0, dataSet.getEntryCount());
TableEntry entry = new TableEntry();
entry.add(new String[] { "1", "2", "3" });
data.append(entry);
entry = (TableEntry) data.getEntry(0);
assertEquals(1, dataSet.getEntryCount());
assertTrue(dataSet.remove(entry));
assertEquals(0, dataSet.getEntryCount());
assertFalse(dataSet.remove(entry));
assertFalse(dataSet.remove(0));
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.table.TableEntry in project linuxtools by eclipse.
the class FilteredTableDataSetTest method testGetColumn.
// Overwrite to ensure the data returned has all the filters applied
@Test
public void testGetColumn() {
TableEntry entry = new TableEntry();
entry.add(new String[] { "1", "2", "3" });
data.append(entry);
assertNull(dataSet.getColumn(-3));
assertNull(dataSet.getColumn(10));
assertNull(dataSet.getColumn(-3, 0, 1));
assertNull(dataSet.getColumn(10, 0, 1));
assertNull(dataSet.getColumn(1, 3, 1));
assertNull(dataSet.getColumn(1, -2, 1));
assertNull(dataSet.getColumn(1, 0, 20));
Object[] col = dataSet.getColumn(0);
assertEquals(1, col.length);
assertSame("1", col[0]);
col = dataSet.getColumn(IDataSet.COL_ROW_NUM);
assertEquals(1, col.length);
assertEquals("1", col[0].toString());
col = dataSet.getColumn(1, 0, 1);
assertEquals(1, col.length);
assertSame("2", col[0]);
}
Aggregations