analysis.timing: remove deprecated code
authorLoïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Tue, 9 May 2017 19:39:23 +0000 (15:39 -0400)
committerJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Thu, 18 May 2017 13:51:37 +0000 (09:51 -0400)
Change-Id: I82ed7944fba56386aa317f349da00ca3cdaf634c
Signed-off-by: Loïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Reviewed-on: https://git.eclipse.org/r/96684
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Hudson CI
Reviewed-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Tested-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
14 files changed:
analysis/org.eclipse.tracecompass.analysis.timing.core/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/statistics/AbstractSegmentStatisticsAnalysis.java
analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/statistics/SegmentStoreStatistics.java [deleted file]
analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/ISegmentStoreDensityViewerDataListener.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsView.java [deleted file]
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsViewer.java [deleted file]
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsView.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/SegmentStoreStatisticsViewer.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableViewer.java
common/org.eclipse.tracecompass.common.core/META-INF/MANIFEST.MF
common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/NonNullUtils.java
common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/log/TraceCompassLogUtils.java

index eb18b07c135dd688966671dd6079b548bebe3481..a7c96d694af593df263bbfccbda028a72c0e28f7 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.analysis.timing.core;singleton:=true
 Bundle-Activator: org.eclipse.tracecompass.internal.analysis.timing.core.Activator
index 486230fa6d2eaef06157c8989de2f359841918e2..29524bf60a28e318057df0fff7ce2106c26c52ac 100644 (file)
@@ -12,7 +12,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.function.Function;
 
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -35,6 +34,7 @@ import com.google.common.collect.ImmutableList;
  * Abstract analysis to build statistics data for a segment store
  *
  * @author Jean-Christian Kouame
+ * @since 3.0
  */
 public abstract class AbstractSegmentStatisticsAnalysis extends TmfAbstractAnalysisModule {
 
@@ -88,29 +88,6 @@ public abstract class AbstractSegmentStatisticsAnalysis extends TmfAbstractAnaly
         return calculateTotalManual(store, monitor);
     }
 
-    /**
-     * Get the total statistics for a specific range. If the range start is
-     * TmfTimeRange.ETERNITY.getStartTime().toNanos() and the range end is
-     * TmfTimeRange.ETERNITY.getEndTime().toNanos(), it will return the
-     * statistics for the whole trace.
-     *
-     * @param start
-     *            The start time of the range
-     * @param end
-     *            The end time of the range
-     * @param monitor
-     *            The progress monitor
-     * @return The total statistics, or null if segment store is not valid or if
-     *         the request is canceled
-     * @since 1.2
-     * @deprecated use {@link #getStatsForRange(long, long, IProgressMonitor)} instead
-     */
-    @Deprecated
-    public @Nullable SegmentStoreStatistics getTotalStatsForRange(long start, long end, IProgressMonitor monitor) {
-        IStatistics<@NonNull ISegment> stats = getStatsForRange(start, end, monitor);
-        return (stats == null) ? null : new SegmentStoreStatistics(stats);
-    }
-
     /**
      * Get the total statistics for a specific range. If the range start is
      * TmfTimeRange.ETERNITY.getStartTime().toNanos() and the range end is
@@ -144,33 +121,6 @@ public abstract class AbstractSegmentStatisticsAnalysis extends TmfAbstractAnaly
         return calculateTotalPerType(store, monitor);
     }
 
-    /**
-     * Get the per segment type statistics for a specific range. If the range
-     * start is TmfTimeRange.ETERNITY.getStartTime().toNanos() and the range end
-     * is TmfTimeRange.ETERNITY.getEndTime().toNanos(), it will return the
-     * statistics for the whole trace.
-     *
-     * @param start
-     *            The start time of the range
-     * @param end
-     *            The end time of the range
-     * @param monitor
-     *            The progress monitor
-     * @return The per segment type statistics, or null if segment store is not
-     *         valid or if the request is canceled
-     * @since 1.2
-     * @deprecated use {@link #getStatsPerTypeForRange(long, long, IProgressMonitor)} instead
-     */
-    @Deprecated
-    public @Nullable Map<String, SegmentStoreStatistics> getPerSegmentTypeStatsForRange(long start, long end, IProgressMonitor monitor) {
-        Map<String, IStatistics<ISegment>> stats = getStatsPerTypeForRange(start, end, monitor);
-        Map<String, SegmentStoreStatistics> map = new HashMap<>();
-        for (Entry<String, IStatistics<ISegment>> entry : stats.entrySet()) {
-            map.put(entry.getKey(), new SegmentStoreStatistics(entry.getValue()));
-        }
-        return map;
-    }
-
     /**
      * Get the per segment type statistics for a specific range. If the range
      * start is TmfTimeRange.ETERNITY.getStartTime().toNanos() and the range end
@@ -274,18 +224,6 @@ public abstract class AbstractSegmentStatisticsAnalysis extends TmfAbstractAnaly
     protected void canceling() {
     }
 
-    /**
-     * The total statistics
-     *
-     * @return the total statistics
-     * @deprecated use {@link #getStatsTotal()} instead
-     */
-    @Deprecated
-    public @Nullable SegmentStoreStatistics getTotalStats() {
-        IStatistics<@NonNull ISegment> totalStats = fTotalStats;
-        return totalStats == null ? null : new SegmentStoreStatistics(totalStats);
-    }
-
     /**
      * Get the statistics for the full segment store
      *
@@ -296,21 +234,6 @@ public abstract class AbstractSegmentStatisticsAnalysis extends TmfAbstractAnaly
         return fTotalStats;
     }
 
-    /**
-     * The per syscall statistics
-     *
-     * @return the per syscall statistics
-     * @deprecated use {@link #getStatsPerType()} instead
-     */
-    @Deprecated
-    public @Nullable Map<String, SegmentStoreStatistics> getPerSegmentTypeStats() {
-        Map<String, SegmentStoreStatistics> map = new HashMap<>();
-        for (Entry<String, IStatistics<ISegment>> entry : fPerSegmentTypeStats.entrySet()) {
-            map.put(entry.getKey(), new SegmentStoreStatistics(entry.getValue()));
-        }
-        return map;
-    }
-
     /**
      * Get the statistics for each type of segment in this segment store
      *
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/statistics/SegmentStoreStatistics.java b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/statistics/SegmentStoreStatistics.java
deleted file mode 100644 (file)
index d20896e..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015, 2016 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:
- *     Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics;
-
-import org.eclipse.tracecompass.analysis.timing.core.statistics.IStatistics;
-import org.eclipse.tracecompass.analysis.timing.core.statistics.Statistics;
-import org.eclipse.tracecompass.segmentstore.core.BasicSegment;
-import org.eclipse.tracecompass.segmentstore.core.ISegment;
-
-/**
- * Class to calculate simple segment store statistics (min, max, average)
- *
- * @author Bernd Hufmann
- * @deprecated Use {@link IStatistics} instead
- */
-@Deprecated
-public class SegmentStoreStatistics {
-
-    private static final ISegment MIN_SEGMENT = new BasicSegment(0, Long.MAX_VALUE);
-    private static final ISegment MAX_SEGMENT = new BasicSegment(Long.MIN_VALUE, 0);
-
-    private final IStatistics<ISegment> fStatistics;
-
-    /**
-     * Constructor
-     */
-    public SegmentStoreStatistics() {
-        fStatistics = new Statistics<>(s -> s.getLength());
-    }
-
-    /**
-     * Constructor
-     *
-     * @param stats The statistics object
-     * @since 1.3
-     */
-    public SegmentStoreStatistics(IStatistics<ISegment> stats) {
-        fStatistics = stats;
-    }
-
-    /**
-     * Get minimum value
-     *
-     * @return minimum value
-     * @since 1.2
-     */
-    public long getMin() {
-        return fStatistics.getMin();
-    }
-
-    /**
-     * Get maximum value
-     *
-     * @return maximum value
-     */
-    public long getMax() {
-        return fStatistics.getMax();
-    }
-
-    /**
-     * Get segment with minimum length
-     *
-     * @return segment with minimum length
-     */
-    public ISegment getMinSegment() {
-        ISegment minObject = fStatistics.getMinObject();
-        return minObject == null ? MIN_SEGMENT : minObject;
-    }
-
-    /**
-     * Get segment with maximum length
-     *
-     * @return segment with maximum length
-     */
-    public ISegment getMaxSegment() {
-        ISegment maxObject = fStatistics.getMaxObject();
-        return maxObject == null ? MAX_SEGMENT : maxObject;
-    }
-
-    /**
-     * Get number of segments analyzed
-     *
-     * @return number of segments analyzed
-     */
-    public long getNbSegments() {
-        return fStatistics.getNbElements();
-    }
-
-    /**
-     * Gets the arithmetic average
-     *
-     * @return arithmetic average
-     */
-    public double getAverage() {
-        return fStatistics.getMean();
-    }
-
-    /**
-     * Gets the standard deviation of the segments, uses the online algorithm
-     * shown here <a href=
-     * "https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm">
-     * Wikipedia article of dec 3 2015 </a>
-     *
-     * @return the standard deviation of the segment store, will return NaN if
-     *         there are less than 3 elements
-     */
-    public double getStdDev() {
-        return fStatistics.getStdDev();
-    }
-
-    /**
-     * Get total value
-     *
-     * @return total value
-     * @since 1.1
-     */
-    public double getTotal() {
-        return fStatistics.getTotal();
-    }
-
-    /**
-     * Update the statistics based on a given segment
-     * <p>
-     * This is an online algorithm and must retain a complexity of O(1)
-     *
-     * @param segment
-     *            the segment used for the update
-     */
-    public void update(ISegment segment) {
-        fStatistics.update(segment);
-    }
-
-    /**
-     * Merge two statistics sets. If the pools are large, there may be a slight
-     * approximation error (empirically, the error is at most 0.001 but usually
-     * around 1e-5 for the standard deviation as this uses pooled variance.
-     *
-     * @param other
-     *            The other segment store statistics
-     * @since 1.2
-     */
-    public void merge(SegmentStoreStatistics other) {
-        fStatistics.merge(other.getStatObject());
-    }
-
-    private IStatistics<ISegment> getStatObject() {
-        return fStatistics;
-    }
-
-}
index d040908d26565f3cbccafbdf32b1c45af88c363d..b6dfed5b6830cb1c0f8abec667dc51459f88607f 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.4.0.qualifier
+Bundle-Version: 2.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.analysis.timing.ui;singleton:=true
 Bundle-Activator: org.eclipse.tracecompass.internal.analysis.timing.ui.Activator
index 98a0a673d498d9cfe3caebcef974bc3630e632b6..49e0cb08819ee2fe9b1310a548a22e8af1f1ffcc 100644 (file)
@@ -44,7 +44,7 @@ public interface ISegmentStoreDensityViewerDataListener {
      *
      * @param newData
      *            the new data
-     * @since 1.4
+     * @since 2.0
      */
     default void viewDataChanged(Iterable<? extends ISegment> newData) {
         // To be implemented by children
@@ -55,7 +55,7 @@ public interface ISegmentStoreDensityViewerDataListener {
      *
      * @param newSelectionData
      *            the new selection of the data
-     * @since 1.4
+     * @since 2.0
      */
     default void selectedDataChanged(@Nullable Iterable<? extends ISegment> newSelectionData) {
         // To be implemented in children
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsView.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsView.java
deleted file mode 100644 (file)
index 2a01975..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015, 2016 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:
- *     Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics;
-
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.ExportToTsvAction;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.ui.views.TmfView;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Joiner;
-
-/**
- * Abstract view to to be extended to display segment store statistics.
- *
- * @author Bernd Hufmann
- * @deprecated use {@link AbstractSegmentsStatisticsView} instead
- */
-@Deprecated
-public abstract class AbstractSegmentStoreStatisticsView extends TmfView {
-
-    private final Action fExportAction = new ExportToTsvAction() {
-        @Override
-        protected void exportToTsv(@Nullable OutputStream stream) {
-            AbstractSegmentStoreStatisticsView.this.exportToTsv(stream);
-        }
-
-        @Override
-        protected @Nullable Shell getShell() {
-            return getViewSite().getShell();
-        }
-
-    };
-
-    private @Nullable AbstractSegmentStoreStatisticsViewer fStatsViewer = null;
-
-    /**
-     * Constructor
-     */
-    public AbstractSegmentStoreStatisticsView() {
-        super("StatisticsView"); //$NON-NLS-1$
-    }
-
-    @Override
-    public void createPartControl(@Nullable Composite parent) {
-        super.createPartControl(parent);
-        AbstractSegmentStoreStatisticsViewer statsViewer = createSegmentStoreStatisticsViewer(NonNullUtils.checkNotNull(parent));
-        ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
-        if (trace != null) {
-            statsViewer.loadTrace(trace);
-        }
-        fStatsViewer = statsViewer;
-        getViewSite().getActionBars().getMenuManager().add(fExportAction);
-    }
-
-    @Override
-    public void setFocus() {
-        AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer;
-        if (statsViewer != null) {
-            statsViewer.getControl().setFocus();
-        }
-    }
-
-    @Override
-    public void dispose() {
-        super.dispose();
-        AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer;
-        if (statsViewer != null) {
-            statsViewer.dispose();
-        }
-    }
-
-    /**
-     * Creates a segment store statistics viewer instance.
-     *
-     * @param parent
-     *            the parent composite to create the viewer in.
-     * @return the latency statistics viewer implementation
-     */
-    protected abstract AbstractSegmentStoreStatisticsViewer createSegmentStoreStatisticsViewer(Composite parent);
-
-    /**
-     * Export a given items's TSV
-     *
-     * @param stream
-     *            an output stream to write the TSV to
-     * @since 1.2
-     */
-    @VisibleForTesting
-    protected void exportToTsv(@Nullable OutputStream stream) {
-        try (PrintWriter pw = new PrintWriter(stream)) {
-            AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer;
-            if (statsViewer == null) {
-                return;
-            }
-            Tree tree = statsViewer.getTreeViewer().getTree();
-            int size = tree.getItemCount();
-            List<String> columns = new ArrayList<>();
-            for (int i = 0; i < tree.getColumnCount(); i++) {
-                String valueOf = String.valueOf(tree.getColumn(i).getText());
-                if (valueOf.isEmpty() && i == tree.getColumnCount() - 1) {
-                    // Linux "feature", an invisible column is added at the end
-                    // with gtk2
-                    break;
-                }
-                columns.add(valueOf);
-            }
-            String join = Joiner.on('\t').skipNulls().join(columns);
-            pw.println(join);
-            for (int i = 0; i < size; i++) {
-                TreeItem item = tree.getItem(i);
-                printItem(pw, columns, item);
-            }
-        }
-    }
-
-    private void printItem(PrintWriter pw, List<String> columns, @Nullable TreeItem item) {
-        if (item == null) {
-            return;
-        }
-        List<String> data = new ArrayList<>();
-        for (int col = 0; col < columns.size(); col++) {
-            data.add(String.valueOf(item.getText(col)));
-        }
-        pw.println(Joiner.on('\t').join(data));
-        for (TreeItem child : item.getItems()) {
-            printItem(pw, columns, child);
-        }
-    }
-
-}
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentStoreStatisticsViewer.java
deleted file mode 100644 (file)
index c27f7ec..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015, 2016 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:
- *     Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.text.Format;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.AbstractSegmentStatisticsAnalysis;
-import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.SegmentStoreStatistics;
-import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.SubSecondTimeWithUnitFormat;
-import org.eclipse.tracecompass.internal.analysis.timing.ui.Activator;
-import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.statistics.Messages;
-import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
-import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractTmfTreeViewer;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.ITmfTreeColumnDataProvider;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.ITmfTreeViewerEntry;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeColumnData;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeViewerEntry;
-
-/**
- * An abstract tree viewer implementation for displaying segment store
- * statistics
- *
- * @author Bernd Hufmann
- * @deprecated use {@link AbstractSegmentsStatisticsViewer} instead
- */
-@Deprecated
-public abstract class AbstractSegmentStoreStatisticsViewer extends AbstractTmfTreeViewer {
-
-    private static final Format FORMATTER = new SubSecondTimeWithUnitFormat();
-
-    private @Nullable TmfAbstractAnalysisModule fModule;
-    private MenuManager fTablePopupMenuManager;
-
-    private static final String[] COLUMN_NAMES = new String[] {
-            checkNotNull(Messages.SegmentStoreStatistics_LevelLabel),
-            checkNotNull(Messages.SegmentStoreStatistics_Statistics_MinLabel),
-            checkNotNull(Messages.SegmentStoreStatistics_MaxLabel),
-            checkNotNull(Messages.SegmentStoreStatistics_AverageLabel),
-            checkNotNull(Messages.SegmentStoreStatisticsViewer_StandardDeviation),
-            checkNotNull(Messages.SegmentStoreStatisticsViewer_Count),
-            checkNotNull(Messages.SegmentStoreStatisticsViewer_Total)
-    };
-
-    /**
-     * Constructor
-     *
-     * @param parent
-     *            the parent composite
-     */
-    public AbstractSegmentStoreStatisticsViewer(Composite parent) {
-        super(parent, false);
-        setLabelProvider(new SegmentStoreStatisticsLabelProvider());
-        fTablePopupMenuManager = new MenuManager();
-        fTablePopupMenuManager.setRemoveAllWhenShown(true);
-        fTablePopupMenuManager.addMenuListener(manager -> {
-            TreeViewer viewer = getTreeViewer();
-            ISelection selection = viewer.getSelection();
-            if (selection instanceof IStructuredSelection) {
-                IStructuredSelection sel = (IStructuredSelection) selection;
-                if (manager != null) {
-                    appendToTablePopupMenu(manager, sel);
-                }
-            }
-        });
-        Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTreeViewer().getTree());
-        Tree tree = getTreeViewer().getTree();
-        tree.setMenu(tablePopup);
-        tree.addDisposeListener(e -> {
-            if (fModule != null) {
-                fModule.dispose();
-            }
-        });
-    }
-
-    /** Provides label for the Segment Store tree viewer cells */
-    protected static class SegmentStoreStatisticsLabelProvider extends TreeLabelProvider {
-
-        @Override
-        public String getColumnText(@Nullable Object element, int columnIndex) {
-            String value = ""; //$NON-NLS-1$
-            if (element instanceof HiddenTreeViewerEntry) {
-                if (columnIndex == 0) {
-                    value = ((HiddenTreeViewerEntry) element).getName();
-                }
-            } else if (element instanceof SegmentStoreStatisticsEntry) {
-                SegmentStoreStatisticsEntry entry = (SegmentStoreStatisticsEntry) element;
-                if (columnIndex == 0) {
-                    return String.valueOf(entry.getName());
-                }
-                if (entry.getEntry().getNbSegments() > 0) {
-                    if (columnIndex == 1) {
-                        value = toFormattedString(entry.getEntry().getMin());
-                    } else if (columnIndex == 2) {
-                        value = String.valueOf(toFormattedString(entry.getEntry().getMax()));
-                    } else if (columnIndex == 3) {
-                        value = String.valueOf(toFormattedString(entry.getEntry().getAverage()));
-                    } else if (columnIndex == 4) {
-                        value = String.valueOf(toFormattedString(entry.getEntry().getStdDev()));
-                    } else if (columnIndex == 5) {
-                        value = String.valueOf(entry.getEntry().getNbSegments());
-                    } else if (columnIndex == 6) {
-                        value = String.valueOf(toFormattedString(entry.getEntry().getTotal()));
-                    }
-                }
-            }
-            return checkNotNull(value);
-        }
-    }
-
-    /**
-     * Creates the statistics analysis module
-     *
-     * @return the statistics analysis module
-     */
-    @Nullable
-    protected abstract TmfAbstractAnalysisModule createStatisticsAnalysiModule();
-
-    /**
-     * Gets the statistics analysis module
-     *
-     * @return the statistics analysis module
-     */
-    @Nullable
-    public TmfAbstractAnalysisModule getStatisticsAnalysisModule() {
-        return fModule;
-    }
-
-    @Override
-    protected ITmfTreeColumnDataProvider getColumnDataProvider() {
-        return new ITmfTreeColumnDataProvider() {
-
-            @Override
-            public List<@Nullable TmfTreeColumnData> getColumnData() {
-                /* All columns are sortable */
-                List<@Nullable TmfTreeColumnData> columns = new ArrayList<>();
-                TmfTreeColumnData column = new TmfTreeColumnData(COLUMN_NAMES[0]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return n1.getName().compareTo(n2.getName());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(COLUMN_NAMES[1]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return Long.compare(n1.getEntry().getMin(), n2.getEntry().getMin());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(COLUMN_NAMES[2]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return Long.compare(n1.getEntry().getMax(), n2.getEntry().getMax());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(COLUMN_NAMES[3]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return Double.compare(n1.getEntry().getAverage(), n2.getEntry().getAverage());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(COLUMN_NAMES[4]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return Double.compare(n1.getEntry().getStdDev(), n2.getEntry().getStdDev());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(COLUMN_NAMES[5]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return Long.compare(n1.getEntry().getNbSegments(), n2.getEntry().getNbSegments());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(COLUMN_NAMES[6]);
-                column.setAlignment(SWT.RIGHT);
-                column.setComparator(new ViewerComparator() {
-                    @Override
-                    public int compare(@Nullable Viewer viewer, @Nullable Object e1, @Nullable Object e2) {
-                        if ((e1 == null) || (e2 == null)) {
-                            return 0;
-                        }
-
-                        SegmentStoreStatisticsEntry n1 = (SegmentStoreStatisticsEntry) e1;
-                        SegmentStoreStatisticsEntry n2 = (SegmentStoreStatisticsEntry) e2;
-
-                        return Double.compare(n1.getEntry().getTotal(), n2.getEntry().getTotal());
-
-                    }
-                });
-                columns.add(column);
-                column = new TmfTreeColumnData(""); //$NON-NLS-1$
-                columns.add(column);
-                return columns;
-            }
-
-        };
-    }
-
-    @Override
-    public void initializeDataSource() {
-        ITmfTrace trace = getTrace();
-        if (trace != null) {
-            TmfAbstractAnalysisModule module = createStatisticsAnalysiModule();
-            if (module == null) {
-                return;
-            }
-            try {
-                module.setTrace(trace);
-                module.schedule();
-                if (fModule != null) {
-                    fModule.dispose();
-                }
-                fModule = module;
-            } catch (TmfAnalysisException e) {
-                Activator.getDefault().logError("Error initializing statistics analysis module", e); //$NON-NLS-1$
-            }
-        }
-    }
-
-    /**
-     * Method to add commands to the context sensitive menu.
-     *
-     * @param manager
-     *            the menu manager
-     * @param sel
-     *            the current selection
-     */
-    protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) {
-        Object element = sel.getFirstElement();
-        if ((element instanceof SegmentStoreStatisticsEntry) && !(element instanceof HiddenTreeViewerEntry)) {
-            final SegmentStoreStatisticsEntry segment = (SegmentStoreStatisticsEntry) element;
-            IAction gotoStartTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMinAction) {
-                @Override
-                public void run() {
-                    long start = segment.getEntry().getMinSegment().getStart();
-                    long end = segment.getEntry().getMinSegment().getEnd();
-                    broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end)));
-                    updateContent(start, end, true);
-                }
-            };
-
-            IAction gotoEndTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMaxAction) {
-                @Override
-                public void run() {
-                    long start = segment.getEntry().getMaxSegment().getStart();
-                    long end = segment.getEntry().getMaxSegment().getEnd();
-                    broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end)));
-                    updateContent(start, end, true);
-                }
-            };
-
-            manager.add(gotoStartTime);
-            manager.add(gotoEndTime);
-        }
-    }
-
-    /**
-     * Formats a double value string
-     *
-     * @param value
-     *            a value to format
-     * @return formatted value
-     */
-    protected static String toFormattedString(double value) {
-        // The cast to long is needed because the formatter cannot truncate the
-        // number.
-        String percentageString = String.format("%s", FORMATTER.format(value)); //$NON-NLS-1$
-        return percentageString;
-    }
-
-    /**
-     * Class for defining an entry in the statistics tree.
-     */
-    protected class SegmentStoreStatisticsEntry extends TmfTreeViewerEntry {
-
-        private final SegmentStoreStatistics fEntry;
-
-        /**
-         * Constructor
-         *
-         * @param name
-         *            name of entry
-         *
-         * @param entry
-         *            segment store statistics object
-         */
-        public SegmentStoreStatisticsEntry(String name, SegmentStoreStatistics entry) {
-            super(name);
-            fEntry = entry;
-        }
-
-        /**
-         * Gets the statistics object
-         *
-         * @return statistics object
-         */
-        public SegmentStoreStatistics getEntry() {
-            return fEntry;
-        }
-
-    }
-
-    @Override
-    protected @Nullable ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) {
-
-        TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule();
-
-        if (getTrace() == null || !(analysisModule instanceof AbstractSegmentStatisticsAnalysis)) {
-            return null;
-        }
-
-        AbstractSegmentStatisticsAnalysis module = (AbstractSegmentStatisticsAnalysis) analysisModule;
-
-        module.waitForCompletion();
-
-        TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); //$NON-NLS-1$
-        List<ITmfTreeViewerEntry> entryList = root.getChildren();
-
-        if (isSelection) {
-            setStats(start, end, entryList, module, true, new NullProgressMonitor());
-        }
-        setStats(start, end, entryList, module, false, new NullProgressMonitor());
-        return root;
-    }
-
-    private void setStats(long start, long end, List<ITmfTreeViewerEntry> entryList, AbstractSegmentStatisticsAnalysis module, boolean isSelection, IProgressMonitor monitor) {
-        String label = isSelection ? getSelectionLabel() : getTotalLabel();
-        final SegmentStoreStatistics entry = isSelection ? module.getTotalStatsForRange(start, end, monitor) : module.getTotalStats();
-        if (entry != null) {
-
-            if (entry.getNbSegments() == 0) {
-                return;
-            }
-            TmfTreeViewerEntry child = new SegmentStoreStatisticsEntry(checkNotNull(label), entry);
-            entryList.add(child);
-
-            final Map<@NonNull String, @NonNull SegmentStoreStatistics> perTypeStats = isSelection? module.getPerSegmentTypeStatsForRange(start, end, monitor) : module.getPerSegmentTypeStats();
-            if (perTypeStats != null) {
-                for (Entry<@NonNull String, @NonNull SegmentStoreStatistics> statsEntry : perTypeStats.entrySet()) {
-                    child.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue()));
-                }
-            }
-        }
-    }
-
-    @Override
-    @TmfSignalHandler
-    public void windowRangeUpdated(@Nullable TmfWindowRangeUpdatedSignal signal) {
-        // Do nothing. We do not want to update the view and lose the selection
-        // if the window range is updated with current selection outside of this
-        // new range.
-    }
-
-    /**
-     * Get the type label
-     *
-     * @return the label
-     * @since 1.2
-     */
-    protected String getTypeLabel() {
-        return checkNotNull(Messages.AbstractSegmentStoreStatisticsViewer_types);
-    }
-
-    /**
-     * Get the total column label
-     *
-     * @return the totals column label
-     * @since 1.2
-     */
-    protected String getTotalLabel() {
-        return checkNotNull(Messages.AbstractSegmentStoreStatisticsViewer_total);
-    }
-
-    /**
-     * Get the selection column label
-     *
-     * @return The selection column label
-     * @since 1.2
-     */
-    protected String getSelectionLabel() {
-        return checkNotNull(Messages.AbstractSegmentStoreStatisticsViewer_selection);
-    }
-
-    /**
-     * Class to define a level in the tree that doesn't have any values.
-     */
-    protected class HiddenTreeViewerEntry extends SegmentStoreStatisticsEntry {
-        /**
-         * Constructor
-         *
-         * @param name
-         *            the name of the level
-         */
-        public HiddenTreeViewerEntry(String name) {
-            super(name, new SegmentStoreStatistics());
-        }
-    }
-
-}
index f5c4d9ab5a27747164759db3a6ba40029d070617..b87ab809ecac3e893289c81bf1457f2eecc8e730 100644 (file)
@@ -157,7 +157,7 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
      *            for table viewers who are part of another view who update the
      *            table's data, this value can be <code>false</code> so only the
      *            other listeners will update the data
-     * @since 1.4
+     * @since 2.0
      */
     public AbstractSegmentStoreTableViewer(TableViewer tableViewer, boolean withListener) {
         super(tableViewer);
index f918db74f50aa02b1586497789470dca51878a07..73ba8a57b0f77b34b241fdbfa6dbc9ee6ccb00c9 100644 (file)
@@ -54,7 +54,7 @@ public class SegmentStoreTableViewer extends AbstractSegmentStoreTableViewer {
      *            for table viewers who are part of another view who update the
      *            table's data, this value can be <code>false</code> so only the
      *            other listeners will update the data
-     * @since 1.4
+     * @since 2.0
      */
     public SegmentStoreTableViewer(TableViewer tableViewer, String analysisId, boolean withListener) {
         super(tableViewer, withListener);
index cd565af1f291f655f4e6546aca853e5ef11b24de..1044a88aed2fbdc65f044b2f5a01606b108200d1 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.3.0.qualifier
+Bundle-Version: 3.0.0.qualifier
 Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.common.core;singleton:=true
 Bundle-Activator: org.eclipse.tracecompass.internal.common.core.Activator
index 50f1d7863d3d9b71931889058c74d93516b3f2e0..59ebefae7c2df3a6f87bdd306532a9a6db44a1cd 100644 (file)
@@ -13,7 +13,6 @@
 package org.eclipse.tracecompass.common.core;
 
 import java.util.Arrays;
-import java.util.Objects;
 import java.util.stream.Stream;
 
 import org.eclipse.jdt.annotation.NonNull;
@@ -24,6 +23,7 @@ import org.eclipse.jdt.annotation.Nullable;
  * annotations.
  *
  * @author Alexandre Montplaisir
+ * @since 3.0
  */
 public final class NonNullUtils {
 
@@ -47,28 +47,6 @@ public final class NonNullUtils {
         return (str == null ? "" : str); //$NON-NLS-1$
     }
 
-    /**
-     * Checks equality with two nullable objects
-     *
-     * @param o1
-     *            the first object to compare
-     * @param o2
-     *            the second object to compare
-     * @return true if o1.equals(o2) or o1 == o2
-     * @since 1.0
-     * @deprecated use {@link Objects#equals(Object)} instead
-     */
-    @Deprecated
-    public static boolean equalsNullable(final @Nullable Object o1, final @Nullable Object o2) {
-        if (o1 == o2) {
-            return true;
-        }
-        if (o1 == null) {
-            return false;
-        }
-        return o1.equals(o2);
-    }
-
     // ------------------------------------------------------------------------
     // checkNotNull() methods, to convert @Nullable references to @NonNull ones
     // ------------------------------------------------------------------------
index 337844e39f6dbbc682c6a2b01358d8c2cbc3d6b3..fcb10245d80d33cb2f4f2eaf36229e758032078a 100644 (file)
@@ -95,7 +95,7 @@ import org.eclipse.jdt.annotation.Nullable;
  * expected.
  *
  * @author Matthew Khouzam
- * @since 2.3
+ * @since 3.0
  * @noinstantiate This class is not intended to be instantiated by clients. It
  *                is a helper class.
  */
This page took 0.040946 seconds and 5 git commands to generate.