DESCRIPTION

tmf : implement ITmfStateValue class to be comparable

Bug 408747

Change-Id: I45a462c56796fa19dacf2c3960721e9d70c553bf
Signed-off-by: Liana Berg xxx@xxx.xxx


COMMENTS

author: Liana Berg
date: 2013-07-31 21:34:18.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2013-07-31 21:34:23.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/sandbox/job/linuxtools/3076/

-------------------------------------
author: Brenden Conley
date: 2013-07-31 21:57:18.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/sandbox/job/linuxtools/3076/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2013-08-08 21:11:36.000000000

Patch Set 3:

(15 comments)

Some comments.

I'm not opposed to the idea, but please give some example in the bug of how it can be useful. Maybe code snippets, showing that it takes less code than with .unboxInt() to do the same thing.

Line:7, /COMMIT_MSG -> "Make ITmfStateValue extend Comparable"

Line:52, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/NullStateValue.java -> A specific implementation should not have knowledge of the other types. You could check if type is null, then do else return something else.

Line:11, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/ITmfStateValue.java -> "Make state values Comparable" maybe

Line:89, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/ITmfStateValue.java -> Javadoc for overriden methods is optional. Here I think it's good to mention that this will compare the inner values of the StateValue. But you could skip xxx@xxx.xxx clause, it will use the one from the Comparable interface.

Line:55, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/StringStateValue.java -> You don't need this variable. You could use "return 1", "return 0" etc. in each clause.

Line:57, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/StringStateValue.java -> Why do you return "greater than" when the other value is null?

Line:67, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/StringStateValue.java -> You could more simply

  return this.unboxStr().compareTo(value.unboxStr());

Line:59, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/IntegerStateValue.java -> See the comments for the LongStateValue. Here you could use Integer.

Line:54, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> Here too, this variable is not needed

Line:56, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> Why is "greater than" returned here?

Line:59, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> To be consistent with what Long does, might be easier to use Long.compareTo() here.

Line:24, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statevalue/TmfStateValueTest.java -> Put your real name ;)

Line:25, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statevalue/TmfStateValueTest.java -> Remove this empty line

Line:29, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statevalue/TmfStateValueTest.java -> use ALL_CAPITALS for constants names.

Line:47, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statevalue/TmfStateValueTest.java -> Perhaps name these testCompareIntToInt(), testCompareStringToInt() and so on.

-------------------------------------
author: Braxton Mccarthy
date: 2013-08-08 21:11:43.000000000

Patch Set 3: Code-Review-1

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