Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Montplaisir2014-05-13 18:01:05 +0000
committerAlexandre Montplaisir2014-05-15 14:30:56 +0000
commit4e8d219d8a9aba89135bf732cbd5370eea6637c8 (patch)
treeb7bb4470a3db12a0baefff90e6102aaf2eb06c0d
parenta64653e681ca404574bb3109e04bf84dcdd53b44 (diff)
downloadorg.eclipse.linuxtools-4e8d219d8a9aba89135bf732cbd5370eea6637c8.tar.gz
org.eclipse.linuxtools-4e8d219d8a9aba89135bf732cbd5370eea6637c8.tar.xz
org.eclipse.linuxtools-4e8d219d8a9aba89135bf732cbd5370eea6637c8.zip
tmf: Cleanup Statistics View classes a bit
- Remove useless interfaces - Change protected fields to private, make some of them static - Use Immutable List/Set where applicable Change-Id: Ia351e820ea6d5988074d227d369db9f821374026 Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-on: https://git.eclipse.org/r/26476 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java6
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java34
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java81
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java64
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java272
5 files changed, 196 insertions, 261 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
index 6e1242d7ca..bfc967c6d1 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
@@ -36,7 +36,6 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
import org.eclipse.linuxtools.tmf.ui.viewers.TmfViewer;
-import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfColumnDataProvider;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnDataProvider;
import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfStatisticsTree;
@@ -306,9 +305,10 @@ public class TmfStatisticsViewer extends TmfViewer {
* This method can be overridden to change the representation of the data in
* the columns.
*
- * @return an object implementing ITmfBaseColumnDataProvider.
+ * @return An object of type {@link TmfBaseColumnDataProvider}.
+ * @since 3.0
*/
- protected ITmfColumnDataProvider getColumnDataProvider() {
+ protected TmfBaseColumnDataProvider getColumnDataProvider() {
return new TmfBaseColumnDataProvider();
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java
deleted file mode 100755
index 5b0b3273b5..0000000000
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfColumnDataProvider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
-
-import java.util.List;
-
-/**
- * Basic methods that must be implemented in a column data provider. The
- * <code>TmfStatisticsView</code> uses classes implementing this interface to
- * define the columns in the statistics tree viewer.
- *
- * @version 2.0
- * @author Mathieu Denis
- * @since 2.0
- */
-public interface ITmfColumnDataProvider {
-
- /**
- * Return a list of the column created for the view
- *
- * @return columns list
- */
- List<TmfBaseColumnData> getColumnData();
-} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java
deleted file mode 100644
index af3d25ac21..0000000000
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/ITmfStatisticsColumnData.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Denis <mathieu.denis@polymtl.ca> - Initial API and Implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
-
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
-
-/**
- * Provide the basic interface to create a statistics column for the statistics
- * table tree.
- *
- * @version 2.0
- * @since 2.0
- * @author Mathieu Denis
- */
-public interface ITmfStatisticsColumnData {
-
- /**
- * Return the column name.
- *
- * @return the name of the column.
- */
- String getHeader();
-
- /**
- * Return the width of the column at the creation.
- *
- * @return the width of the column.
- */
- int getWidth();
-
- /**
- * Return the alignment of the column.
- *
- * @see org.eclipse.swt.SWT
- * @return an integer representing the alignment inside the column.
- */
- int getAlignment();
-
- /**
- * Provide the text to show in the tooltip when the cursor comes over the
- * column header.
- *
- * @return text to show in the tooltip
- */
- String getTooltip();
-
- /**
- * Return the labelProvider which provides the information to put in column
- * cells.
- *
- * @return a ColumnLabelProvider.
- */
- ColumnLabelProvider getLabelProvider();
-
- /**
- * Return a ViewerComparator used to sort viewer's contents.
- *
- * @return the comparator.
- */
- ViewerComparator getComparator();
-
- /**
- * Return the provider of the percentage. Used to draw bar charts in
- * columns.
- *
- * @return the percentageProvider.
- */
- ITmfColumnPercentageProvider getPercentageProvider();
-}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java
index 69d4b46299..804e1f23f5 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnData.java
@@ -13,53 +13,53 @@
package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ViewerComparator;
/**
* Contains all the information necessary to build a column of the table.
*
- * @version 2.0
* @author Mathieu Denis
* @since 2.0
*/
-public class TmfBaseColumnData implements ITmfStatisticsColumnData {
+public class TmfBaseColumnData {
/**
* Name of the column.
*/
- protected final String fHeader;
+ private final String fHeader;
/**
* Width of the column.
*/
- protected final int fWidth;
+ private final int fWidth;
/**
* Alignment of the column.
*/
- protected final int fAlignment;
+ private final int fAlignment;
/**
* Tooltip of the column.
*/
- protected final String fTooltip;
+ private final String fTooltip;
/**
* Adapts a StatisticsTreeNode into the content of it's corresponding cell
* for that column.
*/
- protected final ColumnLabelProvider fLabelProvider;
+ private final ColumnLabelProvider fLabelProvider;
/**
* Used to sort elements of this column. Can be null.
*/
- protected final ViewerComparator fComparator;
+ private final @Nullable ViewerComparator fComparator;
/**
* Used to draw bar charts in this column. Can be null.
*/
- protected final ITmfColumnPercentageProvider fPercentageProvider;
+ private final @Nullable ITmfColumnPercentageProvider fPercentageProvider;
/**
* Used to draw bar charts in columns.
@@ -109,37 +109,69 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData {
fPercentageProvider = p;
}
- @Override
+ /**
+ * Return the column name.
+ *
+ * @return the name of the column.
+ */
public String getHeader() {
return fHeader;
}
- @Override
+ /**
+ * Return the width of the column at the creation.
+ *
+ * @return the width of the column.
+ */
public int getWidth() {
return fWidth;
}
- @Override
+ /**
+ * Return the alignment of the column.
+ *
+ * @see org.eclipse.swt.SWT
+ * @return an integer representing the alignment inside the column.
+ */
public int getAlignment() {
return fAlignment;
}
- @Override
+ /**
+ * Provide the text to show in the tooltip when the cursor comes over the
+ * column header.
+ *
+ * @return text to show in the tooltip
+ */
public String getTooltip() {
return fTooltip;
}
- @Override
+ /**
+ * Return the labelProvider which provides the information to put in column
+ * cells.
+ *
+ * @return a ColumnLabelProvider.
+ */
public ColumnLabelProvider getLabelProvider() {
return fLabelProvider;
}
- @Override
+ /**
+ * Return a ViewerComparator used to sort viewer's contents.
+ *
+ * @return the comparator.
+ */
public ViewerComparator getComparator() {
return fComparator;
}
- @Override
+ /**
+ * Return the provider of the percentage. Used to draw bar charts in
+ * columns.
+ *
+ * @return the percentageProvider.
+ */
public ITmfColumnPercentageProvider getPercentageProvider() {
return fPercentageProvider;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
index 4e39a031ea..a2bb4b51af 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
@@ -12,11 +12,8 @@
package org.eclipse.linuxtools.tmf.ui.viewers.statistics.model;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.Vector;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -27,160 +24,181 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
/**
* Create a basic list of columns with providers.
*
- * @version 2.0
* @author Mathieu Denis
* @since 2.0
*/
-public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
+public class TmfBaseColumnDataProvider {
- /**
- * Contains the list of the columns
- */
- protected List<TmfBaseColumnData> fColumnData = null;
+ // ------------------------------------------------------------------------
+ // Localized strings
+ // ------------------------------------------------------------------------
- /**
- * Level column names
- */
- protected final static String LEVEL_COLUMN = Messages.TmfStatisticsView_LevelColumn;
+ /** Level column names */
+ private static final String LEVEL_COLUMN = Messages.TmfStatisticsView_LevelColumn;
- /**
- * Number of events column names
- */
- protected final static String EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsColumn;
+ /** Number of events column names */
+ private static final String EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsColumn;
- /**
- * Number of events in time range column names
- * @since 2.0
- */
- protected final static String PARTIAL_EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsTimeRangeColumn;
- /**
- * Level column tooltips
- */
- protected final static String LEVEL_COLUMN_TIP = Messages.TmfStatisticsView_LevelColumnTip;
+ /** Number of events in time range column names */
+ private static final String PARTIAL_EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsTimeRangeColumn;
- /**
- * Number of events column tooltips
- */
- protected final static String EVENTS_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTip;
+ /** Level column tooltips */
+ private static final String LEVEL_COLUMN_TIP = Messages.TmfStatisticsView_LevelColumnTip;
+
+ /** Number of events column tooltips */
+ private static final String EVENTS_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTip;
+
+ /** Number of events in time range column tooltips */
+ private static final String PARTIAL_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTimeRangeTip;
+
+ // ------------------------------------------------------------------------
+ // Class attributes
+ // ------------------------------------------------------------------------
+
+ /** Level for which statistics should not be displayed. */
+ private static final Set<String> HIDDEN_FOLDER_LEVELS = ImmutableSet.of("Event Types"); //$NON-NLS-1$
+
+ // ------------------------------------------------------------------------
+ // Instance fields
+ // ------------------------------------------------------------------------
/**
- * Number of events in time range column tooltips
- * @since 2.0
- */
- protected final static String PARTIAL_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTimeRangeTip;
- /**
- * Level for which statistics should not be displayed.
+ * Contains the list of the columns
*/
- protected Set<String> fFolderLevels = new HashSet<>(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$
+ private final List<TmfBaseColumnData> fColumnData;
/**
* Create basic columns to represent the statistics data
*/
public TmfBaseColumnDataProvider() {
/* List that will be used to create the table. */
- fColumnData = new Vector<>();
+ ImmutableList.Builder<TmfBaseColumnData> builder = new ImmutableList.Builder<>();
/* Column showing the name of the events and its level in the tree */
- fColumnData.add(new TmfBaseColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP, new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- return ((TmfStatisticsTreeNode) element).getName();
- }
-
- @Override
- public Image getImage(Object element) {
- TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
- if (fFolderLevels.contains(node.getName())) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- }
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
- }
- }, new ViewerComparator() {
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
- TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
-
- return n1.getName().compareTo(n2.getName());
- }
- }, null));
+ builder.add(new TmfBaseColumnData(
+ LEVEL_COLUMN,
+ 200,
+ SWT.LEFT,
+ LEVEL_COLUMN_TIP,
+ new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((TmfStatisticsTreeNode) element).getName();
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
+ if (HIDDEN_FOLDER_LEVELS.contains(node.getName())) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ }
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
+ }
+ },
+ new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
+ TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
+
+ return n1.getName().compareTo(n2.getName());
+ }
+ },
+ null));
/* Column showing the total number of events */
- fColumnData.add(new TmfBaseColumnData(EVENTS_COUNT_COLUMN, 140, SWT.LEFT, EVENTS_COUNT_COLUMN_TIP, new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
- if (!fFolderLevels.contains(node.getName())) {
- return Long.toString(node.getValues().getTotal());
- }
- return ""; //$NON-NLS-1$
- }
- }, new ViewerComparator() {
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
- TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
-
- return (int) (n1.getValues().getTotal() - n2.getValues().getTotal());
- }
- }, new ITmfColumnPercentageProvider() {
-
- @Override
- public double getPercentage(TmfStatisticsTreeNode node) {
- TmfStatisticsTreeNode parent = node;
- do {
- parent = parent.getParent();
- } while (parent != null && parent.getValues().getTotal() == 0);
-
- if (parent == null) {
- return 0;
- }
- return (double) node.getValues().getTotal() / parent.getValues().getTotal();
- }
- }));
+ builder.add(new TmfBaseColumnData(
+ EVENTS_COUNT_COLUMN,
+ 140,
+ SWT.LEFT,
+ EVENTS_COUNT_COLUMN_TIP,
+ new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
+ if (!HIDDEN_FOLDER_LEVELS.contains(node.getName())) {
+ return Long.toString(node.getValues().getTotal());
+ }
+ return ""; //$NON-NLS-1$
+ }
+ },
+ new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
+ TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
+
+ return (int) (n1.getValues().getTotal() - n2.getValues().getTotal());
+ }
+ },
+ new ITmfColumnPercentageProvider() {
+ @Override
+ public double getPercentage(TmfStatisticsTreeNode node) {
+ TmfStatisticsTreeNode parent = node;
+ do {
+ parent = parent.getParent();
+ } while (parent != null && parent.getValues().getTotal() == 0);
+
+ if (parent == null) {
+ return 0;
+ }
+ return (double) node.getValues().getTotal() / parent.getValues().getTotal();
+ }
+ }));
/* Column showing the number of events within the selected time range */
- fColumnData.add(new TmfBaseColumnData(PARTIAL_EVENTS_COUNT_COLUMN, 140, SWT.LEFT, PARTIAL_COUNT_COLUMN_TIP,
+ builder.add(new TmfBaseColumnData(
+ PARTIAL_EVENTS_COUNT_COLUMN,
+ 140,
+ SWT.LEFT,
+ PARTIAL_COUNT_COLUMN_TIP,
new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
- if (!fFolderLevels.contains(node.getName())) {
- return Long.toString(node.getValues().getPartial());
- }
- return ""; //$NON-NLS-1$
- }
- }, new ViewerComparator() {
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
- TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
-
- return (int) (n1.getValues().getPartial() - n2.getValues().getPartial());
- }
- }, new ITmfColumnPercentageProvider() {
-
- @Override
- public double getPercentage(TmfStatisticsTreeNode node) {
- TmfStatisticsTreeNode parent = node;
- do {
- parent = parent.getParent();
- } while (parent != null && parent.getValues().getPartial() == 0);
-
- if (parent == null) {
- return 0;
- }
- return (double) node.getValues().getPartial() / parent.getValues().getPartial();
- }
- }));
+ @Override
+ public String getText(Object element) {
+ TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
+ if (!HIDDEN_FOLDER_LEVELS.contains(node.getName())) {
+ return Long.toString(node.getValues().getPartial());
+ }
+ return ""; //$NON-NLS-1$
+ }
+ },
+ new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
+ TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
+
+ return (int) (n1.getValues().getPartial() - n2.getValues().getPartial());
+ }
+ },
+ new ITmfColumnPercentageProvider() {
+ @Override
+ public double getPercentage(TmfStatisticsTreeNode node) {
+ TmfStatisticsTreeNode parent = node;
+ do {
+ parent = parent.getParent();
+ } while (parent != null && parent.getValues().getPartial() == 0);
+
+ if (parent == null) {
+ return 0;
+ }
+ return (double) node.getValues().getPartial() / parent.getValues().getPartial();
+ }
+ }));
+
+ fColumnData = builder.build();
}
/**
- * Provide the columns to represent statistics data
+ * Return a list of the column created for the view
+ *
+ * @return columns list
*/
- @Override
public List<TmfBaseColumnData> getColumnData() {
return fColumnData;
}

Back to the top