From 20ff3b75e76264b09d2930494cb43a3bb785e94c Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 12 Jun 2012 17:06:15 -0400 Subject: [PATCH] tmf: Update some Javadoc in tmf.ui Signed-off-by: Alexandre Montplaisir --- .../tmf/ui/views/filter/FilterManager.java | 11 ++ .../tmf/ui/views/filter/FilterView.java | 25 ++-- .../tmf/ui/views/histogram/Histogram.java | 83 ++++++++----- .../ui/views/histogram/HistogramRequest.java | 41 +++--- .../views/histogram/HistogramScaledData.java | 24 ++-- .../tmf/ui/views/histogram/HistogramZoom.java | 49 +++++--- .../views/statistics/TmfStatisticsView.java | 73 ++++++----- .../model/AbsTmfStatisticsTree.java | 38 +++--- .../statistics/model/TmfBaseColumnData.java | 38 ++++-- .../model/TmfBaseColumnDataProvider.java | 8 +- .../model/TmfStatisticsTreeRootFactory.java | 46 ++++--- .../timechart/TimeChartAnalysisEntry.java | 22 ++++ .../TimeChartDecorationProvider.java | 117 +++++++++++++----- .../ui/views/timechart/TimeChartEvent.java | 92 +++++++++++++- 14 files changed, 465 insertions(+), 202 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterManager.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterManager.java index 4411927db5..2b2d4c9126 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterManager.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterManager.java @@ -48,10 +48,21 @@ public class FilterManager { } } + /** + * Retrieve the currently saved filters + * + * @return The array of filters + */ public static ITmfFilterTreeNode[] getSavedFilters() { return fRoot.clone().getChildren(); } + /** + * Set the passed filters as the currently saved ones. + * + * @param filters + * The filters to save + */ public static void setSavedFilters(ITmfFilterTreeNode[] filters) { fRoot = new TmfFilterRootNode(); for (ITmfFilterTreeNode filter : filters) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterView.java index e45e76f7d7..d9e60adaf0 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterView.java @@ -52,9 +52,10 @@ import org.xml.sax.SAXException; */ public class FilterView extends TmfView { - public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.filter"; //$NON-NLS-1$ + /** ID for the Filter view */ + public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.filter"; //$NON-NLS-1$ - private static final Image SAVE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/save_button.gif"); //$NON-NLS-1$ + private static final Image SAVE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/save_button.gif"); //$NON-NLS-1$ private static final Image ADD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$ private static final Image DELETE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$ private static final Image IMPORT_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/import_button.gif"); //$NON-NLS-1$ @@ -64,16 +65,16 @@ public class FilterView extends TmfView { // Main data structures // ------------------------------------------------------------------------ - private FilterViewer fViewer; + private FilterViewer fViewer; private final ITmfFilterTreeNode fRoot; private final IWorkspace fWorkspace; private SaveAction fSaveAction; - private AddAction fAddAction; - private DeleteAction fDeleteAction; - private ExportAction fExportAction; - private ImportAction fImportAction; + private AddAction fAddAction; + private DeleteAction fDeleteAction; + private ExportAction fExportAction; + private ImportAction fImportAction; /** * Getter for the Filter Tree Root @@ -90,13 +91,13 @@ public class FilterView extends TmfView { // ------------------------------------------------------------------------ /** - * Default Constructor + * Default Constructor */ - public FilterView() { - super("Filter"); //$NON-NLS-1$ + public FilterView() { + super("Filter"); //$NON-NLS-1$ - fWorkspace = ResourcesPlugin.getWorkspace(); - try { + fWorkspace = ResourcesPlugin.getWorkspace(); + try { fWorkspace.getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { Activator.getDefault().logError("Error refreshing workspace", e); //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java index 17efdea650..48d11d1575 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011, 2012 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: * Francois Chouinard - Initial API and implementation * Bernd Hufmann - Changed to updated histogram data model @@ -39,7 +39,7 @@ import org.eclipse.swt.widgets.Text; /** * Re-usable histogram widget. - * + * * It has the following features: * - * + * * @version 1.0 * @author Francois Chouinard */ @@ -122,7 +122,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi */ protected final HistogramDataModel fDataModel; /** - * The histogram data model scaled to current resolution and screen width. + * The histogram data model scaled to current resolution and screen width. */ protected HistogramScaledData fScaledData; @@ -134,7 +134,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi /** * Standard constructor. - * + * * @param view A reference to the parent TMF view. * @param parent A parent composite */ @@ -291,8 +291,8 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi return fDataModel.getTimeLimit(); } - /** - * Returns a data model reference. + /** + * Returns a data model reference. * @return data model. */ public HistogramDataModel getDataModel() { @@ -303,7 +303,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi // Operations // ------------------------------------------------------------------------ /** - * Updates the time range. + * Updates the time range. * @param startTime A start time * @param endTime A end time. */ @@ -319,8 +319,11 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi /** * Increase the histogram bucket corresponding to [timestamp] - * + * + * @param eventCount + * The new event count * @param timestamp + * The latest timestamp */ public void countEvent(final long eventCount, final long timestamp) { fDataModel.countEvent(eventCount, timestamp); @@ -328,8 +331,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi /** * Sets the current event time and refresh the display - * + * * @param timestamp + * The time of the current event */ public void setCurrentEvent(final long timestamp) { fCurrentEventTime = (timestamp > 0) ? timestamp : 0; @@ -338,7 +342,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi /** * Computes the timestamp of the bucket at [offset] - * + * * @param offset offset from the left on the histogram * @return the start timestamp of the corresponding bucket */ @@ -353,59 +357,69 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi /** * Computes the offset of the timestamp in the histogram - * + * * @param timestamp the timestamp * @return the offset of the corresponding bucket (-1 if invalid) */ public synchronized int getOffset(final long timestamp) { - if (timestamp < fDataModel.getFirstBucketTime() || timestamp > fDataModel.getEndTime()) + if (timestamp < fDataModel.getFirstBucketTime() || timestamp > fDataModel.getEndTime()) { return -1; + } return (int) ((timestamp - fDataModel.getFirstBucketTime()) / fScaledData.fBucketDuration); } /** * Move the currently selected bar cursor to a non-empty bucket. - * + * * @param keyCode the SWT key code */ protected void moveCursor(final int keyCode) { - if (fScaledData.fCurrentBucket == HistogramScaledData.OUT_OF_RANGE_BUCKET) + if (fScaledData.fCurrentBucket == HistogramScaledData.OUT_OF_RANGE_BUCKET) { return; + } int index; switch (keyCode) { case SWT.HOME: index = 0; - while (index < fScaledData.fLastBucket && fScaledData.fData[index] == 0) + while (index < fScaledData.fLastBucket && fScaledData.fData[index] == 0) { index++; - if (index < fScaledData.fLastBucket) + } + if (index < fScaledData.fLastBucket) { fScaledData.fCurrentBucket = index; + } break; case SWT.ARROW_RIGHT: index = fScaledData.fCurrentBucket + 1; - while (index < fScaledData.fWidth && fScaledData.fData[index] == 0) + while (index < fScaledData.fWidth && fScaledData.fData[index] == 0) { index++; - if (index < fScaledData.fLastBucket) + } + if (index < fScaledData.fLastBucket) { fScaledData.fCurrentBucket = index; + } break; case SWT.END: index = fScaledData.fLastBucket; - while (index >= 0 && fScaledData.fData[index] == 0) + while (index >= 0 && fScaledData.fData[index] == 0) { index--; - if (index >= 0) + } + if (index >= 0) { fScaledData.fCurrentBucket = index; + } break; case SWT.ARROW_LEFT: index = fScaledData.fCurrentBucket - 1; - while (index >= 0 && fScaledData.fData[index] == 0) + while (index >= 0 && fScaledData.fData[index] == 0) { index--; - if (index >= 0) + } + if (index >= 0) { fScaledData.fCurrentBucket = index; + } break; default: @@ -420,7 +434,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi */ @Override public void modelUpdated() { - if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null) + if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null) { fCanvas.getDisplay().asyncExec(new Runnable() { @Override public void run() { @@ -428,8 +442,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi // Retrieve and normalize the data final int canvasWidth = fCanvas.getBounds().width; final int canvasHeight = fCanvas.getBounds().height; - if (canvasWidth <= 0 || canvasHeight <= 0) + if (canvasWidth <= 0 || canvasHeight <= 0) { return; + } fDataModel.setCurrentEvent(fCurrentEventTime); fScaledData = fDataModel.scaleTo(canvasWidth, canvasHeight, HISTOGRAM_BAR_WIDTH); synchronized(fScaledData) { @@ -446,6 +461,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi } } }); + } } // ------------------------------------------------------------------------ @@ -473,8 +489,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi final int canvasHeight = fCanvas.getBounds().height; // Make sure we have something to draw upon - if (canvasWidth <= 0 || canvasHeight <= 0) + if (canvasWidth <= 0 || canvasHeight <= 0) { return; + } // Retrieve image; re-create only if necessary Image image = (Image) fCanvas.getData(IMAGE_KEY); @@ -492,8 +509,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi private void formatImage(final GC imageGC, final Image image) { - if (fScaledData == null) + if (fScaledData == null) { return; + } final HistogramScaledData scaledData = new HistogramScaledData(fScaledData); @@ -516,13 +534,15 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi // Draw the current event bar final int currentBucket = scaledData.fCurrentBucket; - if (currentBucket >= 0 && currentBucket < limit) + if (currentBucket >= 0 && currentBucket < limit) { drawDelimiter(imageGC, fCurrentEventColor, height, currentBucket); + } // Add a dashed line as a delimiter (at the right of the last bar) int lastEventIndex = limit - 1; - while (lastEventIndex >= 0 && scaledData.fData[lastEventIndex] == 0) + while (lastEventIndex >= 0 && scaledData.fData[lastEventIndex] == 0) { lastEventIndex--; + } lastEventIndex += (lastEventIndex < limit - 1) ? 1 : 0; drawDelimiter(imageGC, fLastEventColor, height, lastEventIndex); } catch (final Exception e) { @@ -595,8 +615,9 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi private String formatToolTipLabel(final int index) { long startTime = fScaledData.getBucketStartTime(fScaledData.fCurrentBucket); // negative values are possible if time values came into the model in decreasing order - if (startTime < 0) + if (startTime < 0) { startTime = 0; + } final long endTime = fScaledData.getBucketEndTime(fScaledData.fCurrentBucket); final int nbEvents = (index >= 0) ? fScaledData.fData[index] : 0; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramRequest.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramRequest.java index 7631916631..433f080d94 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramRequest.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramRequest.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2009, 2011, 2012 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: * William Bourque - Initial API and implementation * Yuriy Vashchuk - Heritage correction. @@ -23,7 +23,7 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; /** * Class to request events for given time range from a trace to fill a HistogramDataModel and HistogramView. - * + * * @version 1.0 * @author Francois Chouinard *

@@ -45,26 +45,37 @@ public class HistogramRequest extends TmfEventRequest { /** * Constructor - * @param histogram The histogram data model - * @param range The time range to request data - * @param rank The index of the first event to retrieve - * @param nbEvents The number of events requested - * @param blockSize the number of events per block - * @param priority the requested execution priority - * + * + * @param histogram + * The histogram data model + * @param range + * The time range to request data + * @param rank + * The index of the first event to retrieve + * @param nbEvents + * The number of events requested + * @param blockSize + * The number of events per block + * @param execType + * The requested execution priority + * */ - public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, int rank, int nbEvents, int blockSize, ITmfDataRequest.ExecutionType execType) { - super(ITmfEvent.class, range, rank, nbEvents, (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, execType); + public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, + int rank, int nbEvents, int blockSize, + ITmfDataRequest.ExecutionType execType) { + super(ITmfEvent.class, range, rank, nbEvents, + (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, + execType); fHistogram = histogram; } // ------------------------------------------------------------------------ // TmfEventRequest // ------------------------------------------------------------------------ - + /** * Handle the event from the trace by updating the histogram data model. - * + * * @param event a event from the trace * @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.core.event.ITmfEvent) */ @@ -79,7 +90,7 @@ public class HistogramRequest extends TmfEventRequest { /** * Complete the request. It also notifies the histogram model about the completion. - * + * * @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleCompleted() */ @Override diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramScaledData.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramScaledData.java index 77469afaef..a21e73424f 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramScaledData.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramScaledData.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011, 2012 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: * Francois Chouinard - Initial API and implementation * Bernd Hufmann - Added setter and getter and bar width support @@ -18,7 +18,7 @@ import java.util.Arrays; /** * Convenience class/struct for scaled histogram data. - * + * * @version 1.0 * @author Francois Chouinard */ @@ -45,7 +45,7 @@ public class HistogramScaledData { */ public int fHeight; /** - * Width of one histogram bar (number of pixels). + * Width of one histogram bar (number of pixels). */ public int fBarWidth; /** @@ -57,7 +57,7 @@ public class HistogramScaledData { */ public long fBucketDuration; /** - * The maximum number of events of all buckets. + * The maximum number of events of all buckets. */ public long fMaxValue; /** @@ -65,7 +65,7 @@ public class HistogramScaledData { */ public int fCurrentBucket; /** - * The index of the last bucket. + * The index of the last bucket. */ public int fLastBucket; /** @@ -121,7 +121,7 @@ public class HistogramScaledData { fScalingFactor = other.fScalingFactor; fFirstBucketTime = other.fFirstBucketTime; } - + // ------------------------------------------------------------------------ // Setter and Getter // ------------------------------------------------------------------------ @@ -135,13 +135,13 @@ public class HistogramScaledData { } /** - * Set the first event time. - * @param firstEventTime + * Set the first event time. + * @param firstEventTime The time to set */ public void setFirstBucketTime(long firstEventTime) { fFirstBucketTime = firstEventTime; } - + /** * Returns the time of the last bucket. * @return last bucket time @@ -149,7 +149,7 @@ public class HistogramScaledData { public long getLastBucketTime() { return getBucketStartTime(fLastBucket); } - + /** * Returns the time of the bucket start time for given index. * @param index A bucket index. @@ -158,7 +158,7 @@ public class HistogramScaledData { public long getBucketStartTime(int index) { return fFirstBucketTime + index * fBucketDuration; } - + /** * Returns the time of the bucket end time for given index. * @param index A bucket index. diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java index b42c807ccb..1b2d88d694 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011, 2012 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: * Francois Chouinard - Initial API and implementation * Francois Chouinard - Moved from LTTng to TMF @@ -19,7 +19,7 @@ import org.eclipse.swt.widgets.Canvas; /** * Class to handle zooming within histogram windows.. - * + * * @version 1.0 * @author Francois Chouinard *

@@ -52,7 +52,20 @@ public class HistogramZoom implements MouseWheelListener { // Constructors // ------------------------------------------------------------------------ - public HistogramZoom(Histogram histogram, Canvas canvas, long start, long end) { + /** + * Standard constructor. + * + * @param histogram + * The parent histogram object + * @param canvas + * The canvas + * @param start + * The start time of the zoom area + * @param end + * The end time of the zoom area + */ + public HistogramZoom(Histogram histogram, Canvas canvas, long start, + long end) { fHistogram = histogram; fCanvas = canvas; fAbsoluteStartTime = start; @@ -109,7 +122,7 @@ public class HistogramZoom implements MouseWheelListener { /** * The the full time range of the histogram - * + * * @param startTime the start time the histogram * @param endTime the end time of the histogram */ @@ -124,15 +137,16 @@ public class HistogramZoom implements MouseWheelListener { * @param duration the duration */ public synchronized void setNewRange(long startTime, long duration) { - if (startTime < fAbsoluteStartTime) + if (startTime < fAbsoluteStartTime) { startTime = fAbsoluteStartTime; + } long endTime = startTime + duration; if (endTime > fAbsoluteEndTime) { endTime = fAbsoluteEndTime; - if (endTime - duration > fAbsoluteStartTime) + if (endTime - duration > fAbsoluteStartTime) { startTime = endTime - duration; - else { + } else { startTime = fAbsoluteStartTime; } } @@ -174,18 +188,22 @@ public class HistogramZoom implements MouseWheelListener { } private long validateStart(long start) { - if (start < fAbsoluteStartTime) + if (start < fAbsoluteStartTime) { start = fAbsoluteStartTime; - if (start > fAbsoluteEndTime) + } + if (start > fAbsoluteEndTime) { start = fAbsoluteEndTime - fMinWindowSize; + } return start; } private long validateEnd(long start, long end) { - if (end > fAbsoluteEndTime) + if (end > fAbsoluteEndTime) { end = fAbsoluteEndTime; - if (end < start + fMinWindowSize) + } + if (end < start + fMinWindowSize) { end = start + fMinWindowSize; + } return end; } @@ -215,7 +233,7 @@ public class HistogramZoom implements MouseWheelListener { // Constructors // -------------------------------------------------------------------- - /** + /** * Constructor of inner class to handle consecutive scrolls of mouse wheel. * @param zoom the histogram zoom reference */ @@ -227,7 +245,7 @@ public class HistogramZoom implements MouseWheelListener { // -------------------------------------------------------------------- // Operation // -------------------------------------------------------------------- - + /** * Increments the number of scroll clicks. * @param nbScrolls the number to add to the current value @@ -251,8 +269,9 @@ public class HistogramZoom implements MouseWheelListener { } } // Done waiting. Notify the histogram. - if (!isInterrupted()) + if (!isInterrupted()) { fZoom.zoom(nbScrollClick); + } } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java index 6727a6b11d..9f40de8aab 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java @@ -1,15 +1,15 @@ /******************************************************************************* * Copyright (c) 2011, 20112 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) - Generalized version based on LTTng * Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming - * + * *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics; @@ -55,11 +55,11 @@ import org.eclipse.swt.widgets.Listener; /** * The generic Statistics View displays statistics for any kind of traces. - * + * * It is implemented according to the MVC pattern. - The model is a TmfStatisticsTreeNode built by the State Manager. - The view is built with a * TreeViewer. - The controller that keeps model and view synchronized is an observer of the model. *

- * + * * @version 1.0 * @author @author Mathieu Denis */ @@ -73,7 +73,7 @@ public class TmfStatisticsView extends TmfView { */ public static final String TMF_STATISTICS_VIEW = "StatisticsView"; //$NON-NLS-1$ /** - * Refresh frequency + * Refresh frequency */ protected static final Long STATS_INPUT_CHANGED_REFRESH = 5000L; /** @@ -107,23 +107,23 @@ public class TmfStatisticsView extends TmfView { /** * Flag to force request the data from trace */ - protected boolean fRequestData = false; + protected boolean fRequestData = false; /** * Object to store the cursor while waiting for the experiment to load */ private Cursor fWaitCursor = null; /** - * View instance counter (for multiple statistic views) + * View instance counter (for multiple statistic views) */ private static int fCountInstance = 0; /** * Number of this instance. Used as an instance ID. */ - private int fInstanceNb; + private final int fInstanceNb; /** * Constructor of a statistics view. - * + * * @param viewName * The name to give to the view. */ @@ -261,20 +261,25 @@ public class TmfStatisticsView extends TmfView { /** * Refresh the view. + * + * @param complete + * Should a pending update be sent afterwards or not */ public void modelInputChanged(boolean complete) { // Ignore update if disposed - if (fTreeViewer.getTree().isDisposed()) + if (fTreeViewer.getTree().isDisposed()) { return; + } fTreeViewer.getTree().getDisplay().asyncExec(new Runnable() { @Override public void run() { - if (!fTreeViewer.getTree().isDisposed()) + if (!fTreeViewer.getTree().isDisposed()) { fTreeViewer.refresh(); + } } }); - + if (complete) { sendPendingUpdate(); } @@ -282,7 +287,7 @@ public class TmfStatisticsView extends TmfView { /** * Called when an experiment request has failed or has been canceled Remove the data retrieved from the experiment from the statistics tree. - * + * * @param name The experiment name */ public void modelIncomplete(String name) { @@ -301,7 +306,7 @@ public class TmfStatisticsView extends TmfView { /** * Handles the signal about disposal of the current experiment. - * + * * @param signal The disposed signal */ @TmfSignalHandler @@ -313,9 +318,9 @@ public class TmfStatisticsView extends TmfView { } /** - * Handler called when an experiment is selected. Checks if the experiment has changed + * Handler called when an experiment is selected. Checks if the experiment has changed * and requests the selected experiment if it has not yet been cached. - * + * * @param signal Contains the information about the selection. */ @TmfSignalHandler @@ -350,7 +355,7 @@ public class TmfStatisticsView extends TmfView { if (same) { // no need to reload data, all traces are already loaded fTreeViewer.setInput(experimentTreeNode); - + resetUpdateSynchronization(); return; @@ -372,7 +377,7 @@ public class TmfStatisticsView extends TmfView { // set input to a clean data model fTreeViewer.setInput(treeModelRoot); - + if (fRequestData) { requestData(experiment, experiment.getTimeRange()); fRequestData = false; @@ -396,10 +401,10 @@ public class TmfStatisticsView extends TmfView { requestData(experiment, signal.getRange()); } - + /** * Return the size of the request when performing background request. - * + * * @return the block size for background request. */ protected int getIndexPageSize() { @@ -408,7 +413,7 @@ public class TmfStatisticsView extends TmfView { /** * Returns the quantity of data to retrieve before a refresh of the view is performed - * + * * @return the quantity of data to retrieve before a refresh of the view is performed. */ protected long getInputChangedRefresh() { @@ -417,7 +422,7 @@ public class TmfStatisticsView extends TmfView { /** * This method can be overridden to implement another way to represent the statistics data and to retrieve the information for display. - * + * * @return a TmfStatisticsData object. */ protected AbsTmfStatisticsTree getStatisticData() { @@ -426,7 +431,7 @@ public class TmfStatisticsView extends TmfView { /** * This method can be overridden to change the representation of the data in the columns. - * + * * @return an object implementing ITmfBaseColumnDataProvider. */ protected ITmfColumnDataProvider getColumnDataProvider() { @@ -435,8 +440,8 @@ public class TmfStatisticsView extends TmfView { /** * Constructs the ID based on the experiment name and fInstanceNb - * - * @param experimentName the name of the trace name to show in the view + * + * @param experimentName the name of the trace name to show in the view * @return a view ID */ protected String getTreeID(String experimentName) { @@ -445,7 +450,7 @@ public class TmfStatisticsView extends TmfView { /** * When the experiment is loading the cursor will be different so the user know the processing is not finished yet. - * + * * @param waitInd Indicates if we need to show the waiting cursor, or the default one */ protected void waitCursor(final boolean waitInd) { @@ -475,7 +480,7 @@ public class TmfStatisticsView extends TmfView { /** * Perform the request for an experiment and populates the statistics tree with event. - * + * * @param experiment experiment for which we need the statistics data. * @param timeRange to request */ @@ -501,7 +506,7 @@ public class TmfStatisticsView extends TmfView { super.handleData(data); if (data != null) { AbsTmfStatisticsTree statisticsData = TmfStatisticsTreeRootFactory.getStatTree(getTreeID(experiment.getName())); - + final String traceName = data.getTrace().getName(); ITmfExtraEventInfo extraInfo = new ITmfExtraEventInfo() { @Override @@ -553,7 +558,7 @@ public class TmfStatisticsView extends TmfView { fRequest.cancel(); } } - + /** * Reset update synchronization information */ @@ -565,10 +570,10 @@ public class TmfStatisticsView extends TmfView { } /** - * Checks if statistic update is ongoing. If it is ongoing the new time range is stored as pending - * + * Checks if statistic update is ongoing. If it is ongoing the new time range is stored as pending + * * @param timeRange - new time range - * @return true if statistic update is ongoing else false + * @return true if statistic update is ongoing else false */ protected boolean checkUpdateBusy(TmfTimeRange timeRange) { synchronized (fStatisticsUpdateSyncObj) { @@ -576,7 +581,7 @@ public class TmfStatisticsView extends TmfView { fStatisticsUpdatePending = true; fStatisticsUpdateRange = timeRange; return true; - } + } fStatisticsUpdateBusy = true; return false; } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java index 75e5e3528d..c62df8a373 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java @@ -1,14 +1,14 @@ /******************************************************************************* * Copyright (c) 2011, 2012 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) - Implementation and Initial API - * + * Mathieu Denis - Implementation and Initial API + * *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -28,7 +28,7 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo; * It allow to implement a tree structure while avoiding the need to run through * the tree each time you need to add a node at a given place. *

- * + * * @version 1.0 * @author Mathieu Denis */ @@ -45,15 +45,16 @@ public abstract class AbsTmfStatisticsTree { /** *

Function to merge many string with more efficacy.

- * + * * @param strings * Strings to merge. * @return A new string containing all the strings. */ public synchronized static String mergeString(String... strings) { fBuilder.setLength(0); - for (String s : strings) + for (String s : strings) { fBuilder.append(s); + } return fBuilder.toString(); } @@ -82,7 +83,7 @@ public abstract class AbsTmfStatisticsTree { /** *

Get a node.

- * + * * @param path * Path to the node. * @return The node or null. @@ -93,7 +94,7 @@ public abstract class AbsTmfStatisticsTree { /** *

Get the children of a node.

- * + * * @param path * Path to the node. * @return Collection containing the children. @@ -102,16 +103,16 @@ public abstract class AbsTmfStatisticsTree { /** *

Get every children of a node, even if it doesn't have any registered events, as opposed to getChildren

- * + * * @param path * Path to the node. * @return Collection containing all the children. */ public abstract Collection getAllChildren(final TmfFixedArray path); - + /** *

Get the map of existing elements of path classified by parent.

- * + * * @return The map. */ public Map> getKeys() { @@ -120,7 +121,7 @@ public abstract class AbsTmfStatisticsTree { /** *

Get or create a node.

- * + * * @param path * Path to the node. * @return The node. @@ -137,17 +138,18 @@ public abstract class AbsTmfStatisticsTree { /** *

Get the parent of a node.

- * + * * @param path * Path to the node. * @return Parent node or null. */ public TmfStatisticsTreeNode getParent(final TmfFixedArray path) { if (path.size() == 1) { - if (path.equals(ROOT)) + if (path.equals(ROOT)) { return null; - else + } else { return get(ROOT); + } } return get(path.subArray(0, path.size() - 1)); } @@ -184,7 +186,7 @@ public abstract class AbsTmfStatisticsTree { * Must make sure the {@link #getChildren(TmfFixedArray)} on the parent node * will return the newly created node. *

- * + * * @param path * Path of the new node. */ @@ -195,7 +197,7 @@ public abstract class AbsTmfStatisticsTree { *

* Work recursively. *

- * + * * @param path * Path to the node. */ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java index 0b7ee870bf..2600102e46 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnData.java @@ -57,21 +57,41 @@ public class TmfBaseColumnData implements ITmfStatisticsColumnData { * Used to draw bar charts in columns. */ public interface ITmfColumnPercentageProvider { + + /** + * Percentage provider + * + * @param node + * The statistics tree node + * @return The value as a percentage + */ public double getPercentage(TmfStatisticsTreeNode node); } /** * Constructor with parameters * - * @param h header of the column. The name will be shown at the top of the column. - * @param w width of the column. - * @param a alignment of the text - * @param t text to shown as a tooltip when the cursor comes over the header - * @param l provide all the column element - * @param c used to compare element between them to be able to classify the content of the columns - * @param p provide the percentage of a specific element - */ - public TmfBaseColumnData(String h, int w, int a, String t, ColumnLabelProvider l, ViewerComparator c, ITmfColumnPercentageProvider p) { + * @param h + * header of the column. The name will be shown at the top of the + * column. + * @param w + * width of the column. + * @param a + * alignment of the text + * @param t + * text to shown as a tooltip when the cursor comes over the + * header + * @param l + * provide all the column element + * @param c + * used to compare element between them to be able to classify + * the content of the columns + * @param p + * provide the percentage of a specific element + */ + public TmfBaseColumnData(String h, int w, int a, String t, + ColumnLabelProvider l, ViewerComparator c, + ITmfColumnPercentageProvider p) { fHeader = h; fWidth = w; fAlignment = a; diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java index 309cb167df..62b8888e06 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java @@ -1,13 +1,13 @@ /******************************************************************************* * Copyright (c) 2011, 2011 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) - Implementation and Initial API + * Mathieu Denis - Implementation and Initial API *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.views.statistics.model; @@ -30,7 +30,7 @@ import org.eclipse.ui.PlatformUI; /** * Create a basic list of columns with providers. - * + * * @version 1.0 * @author Mathieu Denis */ diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java index 02d8d74551..1c90f0c5bc 100755 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeRootFactory.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011 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 *******************************************************************************/ @@ -17,11 +17,11 @@ import java.util.Map; /** * Factory class to create and store TMF statistic trees. - * + * * Based on a given tree node ID a TMF statistic tree is stored internally. - * A root node is created for each tree. Using the tree node ID the statistics - * tree can be retrieved. - * + * A root node is created for each tree. Using the tree node ID the statistics + * tree can be retrieved. + * * @version 1.0 * @author Mathieu Denis * @@ -42,7 +42,9 @@ public class TmfStatisticsTreeRootFactory { /** * Provide a statisticsTree instance per trace - * + * + * @param traceUniqueId + * Unique ID for the trace * @return the corresponding trace statistics tree */ public static TmfStatisticsTreeNode getStatTreeRoot(String traceUniqueId) { @@ -55,30 +57,37 @@ public class TmfStatisticsTreeRootFactory { } /** - * + * Get the tree that's being used for statistics + * * @param traceUniqueId + * Unique ID for the trace * @return the corresponding trace statistics tree */ public static AbsTmfStatisticsTree getStatTree(String traceUniqueId) { - if (traceUniqueId == null) + if (traceUniqueId == null) { return null; + } AbsTmfStatisticsTree tree = fTreeInstances.get(traceUniqueId); return tree; } /** - * Add the new trace statistics data in the tree. Can be used later on if the same traces is selected back. - * + * Add the new trace statistics data in the tree. Can be used later on if + * the same traces is selected back. + * * @param traceUniqueId - * the name of the trace which will be used as a key to store the data. Must be different for each traces, otherwise the traces might - * be overwritten which would trigger a reload of the same trace. + * The name of the trace which will be used as a key to store the + * data. Must be different for each traces, otherwise the traces + * might be overwritten which would trigger a reload of the same + * trace. * @param statsData - * the information about the trace + * The information about the trace */ public static void addStatsTreeRoot(String traceUniqueId, AbsTmfStatisticsTree statsData) { - if (traceUniqueId == null || statsData == null) + if (traceUniqueId == null || statsData == null) { return; + } fTreeInstances.put(traceUniqueId, statsData); // if called for the first time, create the root node @@ -86,8 +95,10 @@ public class TmfStatisticsTreeRootFactory { } /** - * + * Return if the given trace is currently known by the statistics manager. + * * @param traceUniqueId + * The unique ID of the trace * @return true if the trace id is known */ public static boolean containsTreeRoot(String traceUniqueId) { @@ -96,8 +107,9 @@ public class TmfStatisticsTreeRootFactory { /** * Remove previously registered statistics tree. - * + * * @param traceUniqueId + * The unique ID of the trace */ public static void removeStatTreeRoot(String traceUniqueId) { if (traceUniqueId != null && fTreeInstances.containsKey(traceUniqueId)) { diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java index 1bf1a992db..c27c6d2c39 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartAnalysisEntry.java @@ -158,6 +158,12 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry { } + /** + * Add a time event to the time chart entry + * + * @param timeEvent + * The event to add + */ public void addTraceEvent(ITimeEvent timeEvent) { long time = timeEvent.getTime(); synchronized (fTraceEvents) { @@ -239,14 +245,30 @@ public class TimeChartAnalysisEntry implements ITimeGraphEntry { } } + /** + * Retrieve the trace associated with this entry + * + * @return The trace object + */ public ITmfTrace getTrace() { return fTrace; } + /** + * Set the last rank of the entry + * + * @param rank + * The rank to set + */ public void setLastRank(long rank) { fLastRank = rank; } + /** + * Retrieve the last rank of the entry + * + * @return The last rank + */ public long getLastRank() { return fLastRank; } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java index 6458f65ab6..7ff3d58956 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartDecorationProvider.java @@ -36,54 +36,103 @@ public class TimeChartDecorationProvider { private ITmfFilter fFilterFilter; private ITmfFilter fSearchFilter; - public TimeChartDecorationProvider(IFile bookmarksFile) { - fBookmarksFile = bookmarksFile; - refreshBookmarks(); + /** + * Constructor + * + * @param bookmarksFile + * Bookmark file associated with the trace + */ + public TimeChartDecorationProvider(IFile bookmarksFile) { + fBookmarksFile = bookmarksFile; + refreshBookmarks(); } - public IFile getBookmarksFile() { - return fBookmarksFile; - } + /** + * Retrieve the bookmark file that was assigned to this provider + * + * @return The bookmark file + */ + public IFile getBookmarksFile() { + return fBookmarksFile; + } - public boolean isBookmark(long rank) { - return fBookmarksSet.contains(rank); + /** + * Verify if the selected rank has a bookmark assigned to it. + * + * @param rank + * The rank to check for + * @return If there is a bookmark there + */ + public boolean isBookmark(long rank) { + return fBookmarksSet.contains(rank); } - public void refreshBookmarks() { - try { - fBookmarksSet.clear(); - for (IMarker bookmark : fBookmarksFile.findMarkers(IMarker.BOOKMARK, false, IResource.DEPTH_ZERO)) { - int location = bookmark.getAttribute(IMarker.LOCATION, -1); - if (location != -1) { - Long rank = (long) location; - fBookmarksSet.add(rank); - } - } + /** + * Refresh the bookmark display. + */ + public void refreshBookmarks() { + try { + fBookmarksSet.clear(); + for (IMarker bookmark : fBookmarksFile.findMarkers( + IMarker.BOOKMARK, false, IResource.DEPTH_ZERO)) { + int location = bookmark.getAttribute(IMarker.LOCATION, -1); + if (location != -1) { + Long rank = (long) location; + fBookmarksSet.add(rank); + } + } } catch (CoreException e) { Activator.getDefault().logError("Error refreshing bookmarks", e); //$NON-NLS-1$ } } - public void filterApplied(ITmfFilter filter) { - fFilterFilter = filter; + /** + * Notify that a filter is now applied on the view. + * + * @param filter + * The filter that was applied + */ + public void filterApplied(ITmfFilter filter) { + fFilterFilter = filter; } - public boolean isVisible(ITmfEvent event) { - if (fFilterFilter != null) { - return fFilterFilter.matches(event); - } - return true; - } + /** + * Check if an event is currently visible in the view or not. + * + * @param event + * The event to check for + * @return If the event is visible or not + */ + public boolean isVisible(ITmfEvent event) { + if (fFilterFilter != null) { + return fFilterFilter.matches(event); + } + return true; + } - public void searchApplied(ITmfFilter filter) { - fSearchFilter = filter; + /** + * Notify that a search is applied on the view. + * + * @param filter + * The search filter that was applied + */ + public void searchApplied(ITmfFilter filter) { + fSearchFilter = filter; } - public boolean isSearchMatch(ITmfEvent event) { - if (fSearchFilter != null) { - return fSearchFilter.matches(event); - } - return false; - } + /** + * Verify if the currently active search filter applies to the given event + * or not. + * + * @param event + * The event to check for + * @return If the event matches + */ + public boolean isSearchMatch(ITmfEvent event) { + if (fSearchFilter != null) { + return fSearchFilter.matches(event); + } + return false; + } } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartEvent.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartEvent.java index 93efed8074..57061c9aea 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartEvent.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timechart/TimeChartEvent.java @@ -44,7 +44,20 @@ public class TimeChartEvent implements ITimeEvent { private TimeChartAnalysisEntry fItemizedEntry; private boolean fItemizing; - public TimeChartEvent(TimeChartAnalysisEntry parentEntry, ITmfEvent event, long rank, TimeChartDecorationProvider decorationProvider) { + /** + * Standard constructor + * + * @param parentEntry + * The parent entry + * @param event + * The event from which this time chart event originates + * @param rank + * The rank of the event in the trace + * @param decorationProvider + * The decoration provider to use + */ + public TimeChartEvent(TimeChartAnalysisEntry parentEntry, ITmfEvent event, + long rank, TimeChartDecorationProvider decorationProvider) { fParentEntry = parentEntry; fTime = event.getTimestamp().normalize(0, TIMESTAMP_SCALE).getValue(); fDuration = 0; @@ -72,18 +85,39 @@ public class TimeChartEvent implements ITimeEvent { return fDuration; } + /** + * Retrieve the rank of the trace event which started this time event. + * + * @return The rank of the beginning + */ public long getFirstRank() { return fFirstRank; } + /** + * Retrieve the rank of the trace event which *finished* this time event. + * + * @return The rank of the end + */ public long getLastRank() { return fLastRank; } + /** + * Get the list of rank ranges corresponding to this time event. + * + * @return The rank range list + */ public RankRangeList getRankRangeList() { return fRankRangeList; } + /** + * Merge another time event with this one. + * + * @param event + * The other event + */ public void merge(TimeChartEvent event) { mergeDecorations(event); if (fTime == event.getTime() && fDuration == event.getDuration()) { @@ -101,6 +135,13 @@ public class TimeChartEvent implements ITimeEvent { } } + /** + * Merge the decorations of another time event with the decorations of this + * one. + * + * @param event + * The other event + */ public void mergeDecorations(TimeChartEvent event) { fColorSettingPriority = Math.min(fColorSettingPriority, event.getColorSettingPriority()); fIsBookmark |= event.fIsBookmark; @@ -108,38 +149,87 @@ public class TimeChartEvent implements ITimeEvent { fIsSearchMatch |= event.fIsSearchMatch; } + /** + * Get the number of time events that have been merged with this one (starts + * counting at 1 if no merge happened). + * + * @return The current number of events in the bath + */ public long getNbEvents() { return fNbEvents; } + /** + * Retrieve the color setting priority. + * + * @return The priority + */ public int getColorSettingPriority() { return fColorSettingPriority; } + /** + * Set the color setting priority. + * + * @param priority + * The priority to set + */ public void setColorSettingPriority(int priority) { fColorSettingPriority = priority; } + /** + * Check if this time event is bookmarked + * + * @return Y/N + */ public boolean isBookmarked() { return fIsBookmark; } + /** + * Set this time event to be bookmarked or not. + * + * @param isBookmarked + * Should time time event become a bookmark, or not + */ public void setIsBookmarked(boolean isBookmarked) { fIsBookmark = isBookmarked; } + /** + * Check if this time is currently visible or not. + * + * @return If the event is visible + */ public boolean isVisible() { return fIsVisible; } + /** + * Set this time event to visible (or to non-visible). + * + * @param isVisible The new status + */ public void setIsVisible(boolean isVisible) { fIsVisible = isVisible; } + /** + * Check if the time event matches the current search. + * + * @return If it matches, Y/N + */ public boolean isSearchMatch() { return fIsSearchMatch; } + /** + * Mark this event as matching (or non-matching) the current search. + * + * @param isSearchMatch + * The new matching status + */ public void setIsSearchMatch(boolean isSearchMatch) { fIsSearchMatch = isSearchMatch; } -- 2.34.1