Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 241343 Details for
Bug 431368
[CLA] Push commit refused because CLA reported signed-off but is valid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch failing to push to gerrit
0001-TMF-Add-get-parent-to-state-system.patch (text/plain), 6.30 KB, created by
Francis Giraldeau
on 2014-03-27 15:02:08 EDT
(
hide
)
Description:
Patch failing to push to gerrit
Filename:
MIME Type:
Creator:
Francis Giraldeau
Created:
2014-03-27 15:02:08 EDT
Size:
6.30 KB
patch
obsolete
>From 7ed2c32bf6a144f29dc23dfe548f494bcdb6e05f Mon Sep 17 00:00:00 2001 >From: Francis Giraldeau <francis.giraldeau@gmail.com> >Date: Tue, 25 Mar 2014 12:00:48 -0400 >Subject: [PATCH] TMF: Add get parent to state system > >It is possible to get the children of an attribute. This patch add also >required methods to query the parent attributes. > >* Add getParent() method to Attribute, AttributeTree and StateSystem >* Add unit test to check the functionality >* Provides the required documentation > >Change-Id: I635326068c2a298b32952599e09b2426b2e1fbb0 >Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com> >--- > .../core/tests/stateprovider/StateSystemTest.java | 19 +++++++++++++++++++ > .../internal/tmf/core/statesystem/Attribute.java | 16 ++++++++++++++++ > .../internal/tmf/core/statesystem/AttributeTree.java | 11 +++++++++++ > .../internal/tmf/core/statesystem/StateSystem.java | 5 +++++ > .../tmf/core/statesystem/ITmfStateSystem.java | 9 +++++++++ > 5 files changed, 60 insertions(+) > >diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java >index 2f46cc3..7370c1a 100644 >--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java >+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java >@@ -422,4 +422,23 @@ public abstract class StateSystemTest { > fail(); > } > } >+ >+ @Test >+ public void testParentAttribute() { >+ String[] path = { "CPUs/0/Current_thread", >+ "CPUs/0", >+ "CPUs" }; >+ try { >+ int q = ssq.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD); >+ for (int i = 0; i < path.length; i++) { >+ String name = ssq.getFullAttributePath(q); >+ assertEquals(path[i], name); >+ q = ssq.getParentAttributeQuark(q); >+ } >+ assertEquals(-1, q); >+ } catch (AttributeNotFoundException e) { >+ fail(); >+ } >+ } >+ > } >diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java >index 4cd830d..a238a0c 100644 >--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java >+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java >@@ -129,6 +129,22 @@ public abstract class Attribute { > return targetNode.getQuark(); > } > >+ /** >+ * Get the parent attribute of this attribute >+ * @return The parent attribute >+ */ >+ public Attribute getParentAttribute() { >+ return this.parent; >+ } >+ >+ /** >+ * Get the parent quark of this attribute >+ * @return The quark of the parent attribute >+ */ >+ public int getParentAttributeQuark() { >+ return this.parent.getQuark(); >+ } >+ > /* The methods how to access children are left to derived classes */ > > /** >diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java >index 3d897c6..49d6dcc 100644 >--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java >+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java >@@ -357,6 +357,17 @@ public final class AttributeTree { > return listOfChildren; > } > >+ /** >+ * Returns the parent quark of the attribute. The root attribute >+ * has no parent. >+ * >+ * @param attributeQuark The quark of the attribute >+ * @return Quark of the parent attribute >+ */ >+ public int getParentAttributeQuark(int quark) { >+ return attributeList.get(quark).getParentAttributeQuark(); >+ } >+ > private void addSubAttributes(List<Integer> list, Attribute curAttribute, > boolean recursive) { > for (Attribute childNode : curAttribute.getSubAttributes()) { >diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java >index 981467f..00871e8 100644 >--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java >+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java >@@ -278,6 +278,11 @@ public class StateSystem implements ITmfStateSystemBuilder { > } > > @Override >+ public int getParentAttributeQuark(int quark) { >+ return getAttributeTree().getParentAttributeQuark(quark); >+ } >+ >+ @Override > public List<Integer> getQuarks(String... pattern) { > List<Integer> quarks = new LinkedList<>(); > List<String> prefix = new LinkedList<>(); >diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java >index 4682c15..3d24b7a 100644 >--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java >+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/ITmfStateSystem.java >@@ -249,6 +249,15 @@ public interface ITmfStateSystem { > String getFullAttributePath(int attributeQuark); > > /** >+ * Returns the parent quark of the attribute. The root attribute >+ * has no parent. >+ * >+ * @param attributeQuark The quark of the attribute >+ * @return Quark of the parent attribute >+ */ >+ int getParentAttributeQuark(int attributeQuark); >+ >+ /** > * @name Query methods > */ > >-- >1.8.3.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 431368
: 241343