TMF: Add get parent to state system
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / statesystem / AttributeTree.java
index 3d897c69e35040a7955b2d0f651681511db8320d..958c867dfc19f4fe6579d3c0b40b4af6e0fd1fe1 100644 (file)
@@ -357,6 +357,22 @@ public final class AttributeTree {
         return listOfChildren;
     }
 
+    /**
+     * Returns the parent quark of the attribute. The root attribute has no
+     * parent and will return <code>-1</code>
+     *
+     * @param quark
+     *            The quark of the attribute
+     * @return Quark of the parent attribute or <code>-1</code> for the root
+     *         attribute
+     */
+    public int getParentAttributeQuark(int quark) {
+        if (quark == -1) {
+            return quark;
+        }
+        return attributeList.get(quark).getParentAttributeQuark();
+    }
+
     private void addSubAttributes(List<Integer> list, Attribute curAttribute,
             boolean recursive) {
         for (Attribute childNode : curAttribute.getSubAttributes()) {
This page took 0.02646 seconds and 5 git commands to generate.