tmf: Introduce ISegmentAspect interfaces
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Tue, 6 Oct 2015 12:58:33 +0000 (08:58 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Fri, 23 Oct 2015 12:55:08 +0000 (08:55 -0400)
Similar to ITmfEventAspect the interface ISegmentAspect provides means
to describe and retrieve the content beyond the data that is provided
by ISegment.

Change-Id: I67facc1212ba222c2012389c25e84d861d1fe190
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/57514
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/segment/ISegmentAspect.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/segment/package-info.java [new file with mode: 0644]

index 1bcc5a5084eab1dea0ada3864d546e2a1128e8ec..821ec1643d5362364c9e6d75feafab89ebf0a86b 100644 (file)
@@ -44,6 +44,7 @@ Export-Package: org.eclipse.tracecompass.internal.tmf.core;x-friends:="org.eclip
  org.eclipse.tracecompass.tmf.core.parsers.custom,
  org.eclipse.tracecompass.tmf.core.project.model,
  org.eclipse.tracecompass.tmf.core.request,
+ org.eclipse.tracecompass.tmf.core.segment,
  org.eclipse.tracecompass.tmf.core.signal,
  org.eclipse.tracecompass.tmf.core.statesystem,
  org.eclipse.tracecompass.tmf.core.statistics,
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/segment/ISegmentAspect.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/segment/ISegmentAspect.java
new file mode 100644 (file)
index 0000000..722ee62
--- /dev/null
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.segment;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.segmentstore.core.ISegment;
+
+/**
+ * An aspect is a piece of information that can be extracted, directly or
+ * indirectly, from a segment {@link ISegment}.
+ *
+ * The aspect can then be used to populate table columns, to filter
+ * on to only keep certain segments, to plot XY charts, etc.
+ *
+ * Inspired by ITmfEventAspect implementation.
+ *
+ * @author Bernd Hufmann
+ * @since 2.0
+ */
+public interface ISegmentAspect {
+
+    /**
+     * Static definition of an empty string.
+     */
+    String EMPTY_STRING = ""; //$NON-NLS-1$
+
+    /**
+     * Get the name of this aspect. This name will be user-visible and, as such,
+     * should be localized.
+     *
+     * @return The name of this aspect.
+     */
+    String getName();
+
+    /**
+     * Return a descriptive help text of what this aspect does. This could then
+     * be shown in tooltip or in option dialogs for instance. It should also be
+     * localized.
+     *
+     * @return The help text of this aspect
+     */
+    String getHelpText();
+
+    /**
+     * The "functor" representing this aspect. Basically, what to do for an
+     * segment that is passed in parameter.
+     *
+     * Users also can (and should) provide a more specific return type than
+     * Object.
+     *
+     * @param segment
+     *            The segment to process
+     * @return The resulting information for this segment.
+     */
+    @Nullable Object resolve(ISegment segment);
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/segment/package-info.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/segment/package-info.java
new file mode 100644 (file)
index 0000000..feaffe4
--- /dev/null
@@ -0,0 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EfficiOS Inc. and others
+ *
+ * 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
+ *******************************************************************************/
+
+@org.eclipse.jdt.annotation.NonNullByDefault
+package org.eclipse.tracecompass.tmf.core.segment;
This page took 0.027132 seconds and 5 git commands to generate.