use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.
the class TestCreateSystemtapScript method createAndViewDummyData.
private static void createAndViewDummyData(String[] titles, Object[] data) {
if (data.length % titles.length != 0) {
throw new IllegalArgumentException("data.length must be a multiple of titles.length.");
}
final int numRows = data.length / titles.length;
IFilteredDataSet dataset = new FilteredRowDataSet(titles);
for (int i = 0; i < numRows; i++) {
IDataEntry dataEntry = new RowEntry();
Object[] values = new Object[titles.length];
for (int v = 0; v < titles.length; v++) {
values[v] = data[titles.length * i + v];
}
dataEntry.putRow(0, values);
dataset.setData(dataEntry);
}
final File dataFile;
try {
dataFile = File.createTempFile("testSet", ".set");
dataFile.deleteOnExit();
if (!dataset.writeToFile(dataFile)) {
throw new IOException();
}
} catch (IOException e) {
fail("Could not create dummy data set.");
return;
}
UIThreadRunnable.syncExec(() -> {
new ImportDataSetHandler().execute(dataFile.getPath());
});
String editorName = dataFile.getName().concat(" Graphs");
bot.waitUntil(new EditorIsActive(editorName));
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.
the class FilteredRowDataSetTest method setUp.
@Before
public void setUp() {
data = new RowDataSet(new String[] { "a", "b", "c" });
fdata = new FilteredRowDataSet(data);
new FilteredRowDataSet(data.getTitles());
entry0 = new RowEntry();
entry0.putRow(0, new String[] { "1", "2", "3" });
data.setData(entry0);
RowEntry entry = new RowEntry();
entry.putRow(0, new String[] { "4", "5", "6" });
data.setData(entry);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.
the class FilteredRowDataSetTest method testAppend.
// Overwrite methods to insure data is removed from the original DataSet
@Test
public void testAppend() {
assertEquals(2, data.getEntryCount());
RowEntry entry = new RowEntry();
entry.putRow(0, new String[] { "1", "2", "3" });
fdata.append(entry);
assertEquals(3, data.getEntryCount());
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.
the class FilteredRowDataSetTest method testRemove.
@Test
public void testRemove() {
assertFalse(fdata.remove(null));
assertFalse(fdata.remove(new RowEntry()));
assertFalse(fdata.remove(-1));
assertFalse(fdata.remove(10));
assertEquals(2, fdata.getEntryCount());
IDataEntry entry = data.getEntry(0);
assertTrue(fdata.remove(entry));
assertEquals(1, fdata.getEntryCount());
assertFalse(fdata.remove(entry));
assertTrue(fdata.remove(0));
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry 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());
}
Aggregations