Search in sources :

Example 11 with RowEntry

use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.

the class MockDataSet method buildDataSet.

public static RowDataSet buildDataSet(int rows, int cols) {
    String[] titles = new String[cols];
    int i;
    for (i = 0; i < cols; i++) titles[i] = "" + i;
    RowDataSet data = new RowDataSet(titles);
    RowEntry entry;
    int j;
    for (i = 0; i < rows; i++) {
        Object[] d = new Object[cols];
        for (j = 0; j < cols; j++) {
            d[j] = i * cols + j;
        }
        entry = new RowEntry();
        entry.putRow(0, d);
        data.append(entry);
    }
    return data;
}
Also used : RowDataSet(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowDataSet) RowEntry(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry)

Example 12 with RowEntry

use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.

the class FilteredRowDataSetTest method testAddFilter.

// End overwrite to ensure the data returned has all the filters applied
// IFilteredDataSet Methods
@Test
public void testAddFilter() {
    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);
    fdata.addFilter(new RangeFilter(0, 3, 5, RangeFilter.INCLUSIVE | RangeFilter.INSIDE_BOUNDS));
    assertEquals(3, fdata.getRowCount());
    Object[] row = fdata.getRow(1);
    assertEquals(4, ((Integer) row[0]).intValue());
    assertEquals(3, ((Integer) row[2]).intValue());
    row = fdata.getRow(2);
    assertEquals(5, ((Integer) row[0]).intValue());
    assertEquals(2, ((Integer) row[1]).intValue());
    fdata.addFilter(new SortFilter(2, SortFilter.ASCENDING));
    assertEquals(3, fdata.getRowCount());
    row = fdata.getRow(0);
    assertEquals(5, ((Integer) row[0]).intValue());
    assertEquals(2, ((Integer) row[2]).intValue());
    row = fdata.getRow(1);
    assertEquals(4, ((Integer) row[0]).intValue());
    assertEquals(3, ((Integer) row[2]).intValue());
}
Also used : SortFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.SortFilter) RowEntry(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry) RangeFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter) Test(org.junit.Test)

Example 13 with RowEntry

use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.

the class FilteredRowDataSetTest method testRemoveFilter.

@Test
public void testRemoveFilter() {
    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.removeFilter(filter);
    assertEquals(5, fdata.getRowCount());
    Object[] row = fdata.getRow(0);
    assertEquals(5, ((Integer) row[0]).intValue());
    assertEquals(2, ((Integer) row[2]).intValue());
    row = fdata.getRow(1);
    assertEquals(4, ((Integer) row[0]).intValue());
    assertEquals(3, ((Integer) row[2]).intValue());
}
Also used : SortFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.SortFilter) RowEntry(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry) RangeFilter(org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter) Test(org.junit.Test)

Example 14 with RowEntry

use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.

the class RowDataSetTest method testRemove.

@Test
public void testRemove() {
    assertFalse(data.remove(null));
    assertFalse(data.remove(new RowEntry()));
    assertFalse(data.remove(-1));
    assertFalse(data.remove(10));
    assertEquals(2, data.getEntryCount());
    IDataEntry entry = data.getEntry(0);
    assertTrue(data.remove(entry));
    assertEquals(1, data.getEntryCount());
    assertFalse(data.remove(entry));
    assertTrue(data.remove(0));
}
Also used : IDataEntry(org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry) RowEntry(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry) Test(org.junit.Test)

Example 15 with RowEntry

use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry in project linuxtools by eclipse.

the class RowEntryTest method testGetRowCount.

@Test
public void testGetRowCount() {
    RowEntry entry2 = new RowEntry();
    assertEquals(0, entry2.getRowCount());
    entry2 = new RowEntry();
    entry2.putRow(0, null);
    assertEquals(0, entry2.getRowCount());
    assertEquals(1, entry.getRowCount());
}
Also used : RowEntry(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry) Test(org.junit.Test)

Aggregations

RowEntry (org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowEntry)16 Test (org.junit.Test)11 IDataEntry (org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry)3 RowDataSet (org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowDataSet)3 RangeFilter (org.eclipse.linuxtools.systemtap.graphing.core.filters.RangeFilter)3 SortFilter (org.eclipse.linuxtools.systemtap.graphing.core.filters.SortFilter)3 Before (org.junit.Before)3 FilteredRowDataSet (org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.FilteredRowDataSet)2 File (java.io.File)1 IOException (java.io.IOException)1 ImportDataSetHandler (org.eclipse.linuxtools.internal.systemtap.ui.ide.handlers.ImportDataSetHandler)1 IFilteredDataSet (org.eclipse.linuxtools.systemtap.graphing.core.datasets.IFilteredDataSet)1 TableEntry (org.eclipse.linuxtools.systemtap.graphing.core.datasets.table.TableEntry)1 Point (org.eclipse.swt.graphics.Point)1