DESCRIPTION

[WIP] tmf: Add TmfCompositeComponent interface and implementation

This is helpful for components which have a parent child relationship
for example experiments and children.

Change-Id: I2fec1da979033454552c45b52e4e2e3153295cd0
Signed-off-by: Ricky Reeves <Meredith xxx@xxx.xxx


COMMENTS

author: Ricky Reeves
date: 2014-03-21 15:22:56.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2014-03-21 16:57:44.000000000

Patch Set 2:

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

-------------------------------------
author: Brenden Conley
date: 2014-03-21 17:45:47.000000000

Patch Set 2: Verified+1

Build Successful 

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

-------------------------------------
author: Annalise Jimenez
date: 2014-03-25 17:10:04.000000000

Patch Set 2: IP-Clean+1

lgtm code-wise. Any reason why this is a wip? If so, I'll wait before making a more thorough review of the patch series.

-------------------------------------
author: Braxton Mccarthy
date: 2014-03-27 18:20:45.000000000

Patch Set 2:

These parent-child relationships will only apply to event providers, right? Why not put these methods in ITmfEventProvider directly?

I also don't see TmfCompositeComponent being used anywhere, everything else (TmfTrace, TmfEventProvider, etc.) already has an implementing class, so can't inherit it.

Quite happy to see null annotations though! :D

-------------------------------------
author: Braxton Mccarthy
date: 2014-03-27 18:46:12.000000000

Patch Set 2: Code-Review-1

(11 comments)

Oh ok I hadn't notcied TmfCompositeComponent was being extended by TmfEventProvider. So the implementation is being used. Still wondering if they should all be in the same class though.

Did some review anway, can't help myself ;)

Line:583, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java -> is getChild() really that slow? Slower than allocation arrays every insertions?? I would think using TmfCompositeComponent would avoid the need for fTraces in here. Now we add a class/interface, but we don't even make use of it.

Line:45, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> Why lock the children list when accessing the parent?

Line:52, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> same question

Line:60, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> not needed

The two following ones are indeed needed though.

Line:69, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> It would be the same to replace the two above lines with:

  for(ITmfCompositeComponent child : fChildren) {

and would take less code

Line:80, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> Since the notion of index in the array is not used, it could be a LinkedList. Or a Set. But it doesn't really matter.

Line:83, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> same here, you can use for-each notation to shorten it up. Java's Iterator really doesn't offer much...

Line:99, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/TmfCompositeComponent.java -> for-each

Line:44, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/ITmfCompositeComponent.java -> for consistency with the getter, the parameter could xxx@xxx.xxx too

Line:60, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/ITmfCompositeComponent.java -> Could return a Collection<ITmfCompositeComponent> to be more generic.

Line:80, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/component/ITmfCompositeComponent.java -> no need for 'public' in the interface

Here too, instead of List<T> it could return Collection<T> to be consistent with the above method.

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