DESCRIPTION

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: Adonis Kirk xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2014-03-28 16:04:19.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2014-03-28 16:04:25.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6132/

-------------------------------------
author: Annalise Jimenez
date: 2014-03-28 16:05:15.000000000

Patch Set 2:

I added a verification if the requested quark is -1 or else it would throw an exception.

-------------------------------------
author: Brenden Conley
date: 2014-03-28 16:42:38.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6132/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2014-03-28 18:50:49.000000000

Patch Set 2: Verified+1 Code-Review+2 IP-Clean+1

I wanted to update the patch to auto-format the javadoc, but Geneviève already did it :)

-------------------------------------
author: Annalise Jimenez
date: 2014-03-28 19:53:43.000000000

Patch Set 2: Verified+1 Code-Review+2 IP-Clean+1

-------------------------------------
author: Ayanna Reed
date: 2014-03-28 20:22:32.000000000

Patch Set 2:

(2 comments)

Line:147, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/Attribute.java -> this.parent is null for the root

Line:370, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java -> I don't like this exception. We can't make the difference beteween the root node (-1) and its direct children. In the two case the resultat is -1.

-------------------------------------
author: Annalise Jimenez
date: 2014-03-28 20:39:34.000000000

Patch Set 2:

(1 comment)

Line:370, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java -> I think it's preferable than throwing a NPE... If you wished to check the root node, you would have done it before calling this method. If you did call this method with the root node, it's because you just care about the result, not the original value... I foresee the use case for it.

But it could return -2 instead I guess and then you could check 'if (quark >= 0)'. I don't care as long as you don't have to do a check before calling it if you don't need to.

-------------------------------------
author: Ayanna Reed
date: 2014-03-28 20:59:43.000000000

Patch Set 2:

(1 comment)

Line:370, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/AttributeTree.java -> Ok with -1, but in this case, you must have here :

public int getParentAttributeQuark(int quark) {
   return attributeList.get(quark).getParentAttributeQuark();
}

and in Attribute.java

public int getParentAttributeQuark() {
        if (this.parent = null) {
             return -1;
        }
	return this.parent.getQuark();
}

-------------------------------------
