Merge branch 'master' into lttng-kepler
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.ui / src / org / eclipse / linuxtools / internal / lttng2 / kernel / ui / views / resources / ResourcesEntry.java
index d2acc99600aca294daee7d8112d3affdc20a0405..585c2e8953efcb77e3dc7a0ffccab9d5543d0775 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2012 Ericsson\r
- *\r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *   Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.common.EventIterator;\r
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;\r
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;\r
-\r
-/**\r
- * An entry, or row, in the resource view\r
- *\r
- * @author Patrick Tasse\r
- */\r
-public class ResourcesEntry implements ITimeGraphEntry {\r
-\r
-    /** Type of resource */\r
-    public static enum Type {\r
-        /** Null resources (filler rows, etc.) */\r
-        NULL,\r
-        /** Entries for CPUs */\r
-        CPU,\r
-        /** Entries for IRQs */\r
-        IRQ,\r
-        /** Entries for Soft IRQ */\r
-        SOFT_IRQ }\r
-\r
-    private final int fQuark;\r
-    private final CtfKernelTrace fTrace;\r
-    private ITimeGraphEntry fParent = null;\r
-    private final ITimeGraphEntry[] children = null;\r
-    private final String fName;\r
-    private final Type fType;\r
-    private final int fId;\r
-    private long fStartTime;\r
-    private long fEndTime;\r
-    private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();\r
-    private List<ITimeEvent> fZoomedEventList = null;\r
-\r
-    /**\r
-     * Standard constructor\r
-     *\r
-     * @param quark\r
-     *            The quark of the state system attribute whose state is shown\r
-     *            on this row\r
-     * @param trace\r
-     *            The trace that this view is talking about\r
-     * @param type\r
-     *            Type of entry, see the Type enum\r
-     * @param id\r
-     *            The integer id associated with this entry or row\r
-     */\r
-    public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) {\r
-        fQuark = quark;\r
-        fTrace = trace;\r
-        fType = type;\r
-        fId = id;\r
-        fName = type.toString() + ' ' + Integer.toString(id);\r
-    }\r
-\r
-    @Override\r
-    public ITimeGraphEntry getParent() {\r
-        return fParent;\r
-    }\r
-\r
-    @Override\r
-    public boolean hasChildren() {\r
-        return children != null && children.length > 0;\r
-    }\r
-\r
-    @Override\r
-    public ITimeGraphEntry[] getChildren() {\r
-        return children;\r
-    }\r
-\r
-    @Override\r
-    public String getName() {\r
-        return fName;\r
-    }\r
-\r
-    @Override\r
-    public long getStartTime() {\r
-        return fStartTime;\r
-    }\r
-\r
-    @Override\r
-    public long getEndTime() {\r
-        return fEndTime;\r
-    }\r
-\r
-    @Override\r
-    public boolean hasTimeEvents() {\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public Iterator<ITimeEvent> getTimeEventsIterator() {\r
-        return new EventIterator(fEventList, fZoomedEventList);\r
-    }\r
-\r
-    @Override\r
-    public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {\r
-        return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);\r
-    }\r
-\r
-    /**\r
-     * Assign a parent entry to this one, to organize them in a tree in the\r
-     * view.\r
-     *\r
-     * @param parent\r
-     *            The parent entry\r
-     */\r
-    public void setParent(ITimeGraphEntry parent) {\r
-        fParent = parent;\r
-    }\r
-\r
-    /**\r
-     * Retrieve the attribute quark that's represented by this entry.\r
-     *\r
-     * @return The integer quark\r
-     */\r
-    public int getQuark() {\r
-        return fQuark;\r
-    }\r
-\r
-    /**\r
-     * Retrieve the trace that is associated to this Resource view.\r
-     *\r
-     * @return The LTTng 2 kernel trace\r
-     */\r
-    public CtfKernelTrace getTrace() {\r
-        return fTrace;\r
-    }\r
-\r
-    /**\r
-     * Get the entry Type of this entry. Uses the inner Type enum.\r
-     *\r
-     * @return The entry type\r
-     */\r
-    public Type getType() {\r
-        return fType;\r
-    }\r
-\r
-    /**\r
-     * Get the integer ID associated with this entry.\r
-     *\r
-     * @return The ID\r
-     */\r
-    public int getId() {\r
-        return fId;\r
-    }\r
-\r
-    /**\r
-     * Assign the target event list to this view.\r
-     *\r
-     * @param eventList\r
-     *            The list of time events\r
-     */\r
-    public void setEventList(List<ITimeEvent> eventList) {\r
-        fEventList = eventList;\r
-        if (eventList != null && eventList.size() > 0) {\r
-            fStartTime = eventList.get(0).getTime();\r
-            ITimeEvent lastEvent = eventList.get(eventList.size() - 1);\r
-            fEndTime = lastEvent.getTime() + lastEvent.getDuration();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Assign the zoomed event list to this view.\r
-     *\r
-     * @param eventList\r
-     *            The list of "zoomed" time events\r
-     */\r
-    public void setZoomedEventList(List<ITimeEvent> eventList) {\r
-        fZoomedEventList = eventList;\r
-    }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 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:
+ *   Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.common.EventIterator;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
+
+/**
+ * An entry, or row, in the resource view
+ *
+ * @author Patrick Tasse
+ */
+public class ResourcesEntry implements ITimeGraphEntry {
+
+    /** Type of resource */
+    public static enum Type {
+        /** Null resources (filler rows, etc.) */
+        NULL,
+        /** Entries for CPUs */
+        CPU,
+        /** Entries for IRQs */
+        IRQ,
+        /** Entries for Soft IRQ */
+        SOFT_IRQ }
+
+    private final int fQuark;
+    private final CtfKernelTrace fTrace;
+    private ITimeGraphEntry fParent = null;
+    private final ITimeGraphEntry[] children = null;
+    private final String fName;
+    private final Type fType;
+    private final int fId;
+    private long fStartTime;
+    private long fEndTime;
+    private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();
+    private List<ITimeEvent> fZoomedEventList = null;
+
+    /**
+     * Standard constructor
+     *
+     * @param quark
+     *            The quark of the state system attribute whose state is shown
+     *            on this row
+     * @param trace
+     *            The trace that this view is talking about
+     * @param type
+     *            Type of entry, see the Type enum
+     * @param id
+     *            The integer id associated with this entry or row
+     */
+    public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) {
+        fQuark = quark;
+        fTrace = trace;
+        fType = type;
+        fId = id;
+        fName = type.toString() + ' ' + Integer.toString(id);
+    }
+
+    @Override
+    public ITimeGraphEntry getParent() {
+        return fParent;
+    }
+
+    @Override
+    public boolean hasChildren() {
+        return children != null && children.length > 0;
+    }
+
+    @Override
+    public ITimeGraphEntry[] getChildren() {
+        return children;
+    }
+
+    @Override
+    public String getName() {
+        return fName;
+    }
+
+    @Override
+    public long getStartTime() {
+        return fStartTime;
+    }
+
+    @Override
+    public long getEndTime() {
+        return fEndTime;
+    }
+
+    @Override
+    public boolean hasTimeEvents() {
+        return true;
+    }
+
+    @Override
+    public Iterator<ITimeEvent> getTimeEventsIterator() {
+        return new EventIterator(fEventList, fZoomedEventList);
+    }
+
+    @Override
+    public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
+        return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);
+    }
+
+    /**
+     * Assign a parent entry to this one, to organize them in a tree in the
+     * view.
+     *
+     * @param parent
+     *            The parent entry
+     */
+    public void setParent(ITimeGraphEntry parent) {
+        fParent = parent;
+    }
+
+    /**
+     * Retrieve the attribute quark that's represented by this entry.
+     *
+     * @return The integer quark
+     */
+    public int getQuark() {
+        return fQuark;
+    }
+
+    /**
+     * Retrieve the trace that is associated to this Resource view.
+     *
+     * @return The LTTng 2 kernel trace
+     */
+    public CtfKernelTrace getTrace() {
+        return fTrace;
+    }
+
+    /**
+     * Get the entry Type of this entry. Uses the inner Type enum.
+     *
+     * @return The entry type
+     */
+    public Type getType() {
+        return fType;
+    }
+
+    /**
+     * Get the integer ID associated with this entry.
+     *
+     * @return The ID
+     */
+    public int getId() {
+        return fId;
+    }
+
+    /**
+     * Assign the target event list to this view.
+     *
+     * @param eventList
+     *            The list of time events
+     */
+    public void setEventList(List<ITimeEvent> eventList) {
+        fEventList = eventList;
+        if (eventList != null && eventList.size() > 0) {
+            fStartTime = eventList.get(0).getTime();
+            ITimeEvent lastEvent = eventList.get(eventList.size() - 1);
+            fEndTime = lastEvent.getTime() + lastEvent.getDuration();
+        }
+    }
+
+    /**
+     * Assign the zoomed event list to this view.
+     *
+     * @param eventList
+     *            The list of "zoomed" time events
+     */
+    public void setZoomedEventList(List<ITimeEvent> eventList) {
+        fZoomedEventList = eventList;
+    }
+}
This page took 0.0316 seconds and 5 git commands to generate.