DESCRIPTION

tmf : add new operations to ItmfStateValue

implement the add operation and the increment operation

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


COMMENTS

author: Liana Berg
date: 2013-08-12 19:00:16.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2013-08-12 19:00:26.000000000

Patch Set 2:

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

-------------------------------------
author: Brenden Conley
date: 2013-08-12 19:21:46.000000000

Patch Set 2: Verified+1

Build Successful 

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

-------------------------------------
author: Braxton Mccarthy
date: 2013-08-12 22:39:02.000000000

Patch Set 2: Code-Review-1

(15 comments)

That looks like a lot of comments for such a small patch, but it's mostly the same things repeated in many classes.

Good job on the tests, those look pretty solid. A small comment on how to format them though.

Line:7, /COMMIT_MSG -> ITmfStateValue

Line:55, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/NullStateValue.java -> I am a bit unsure about this. Since NullStateValue can be unboxed as an Int, one might think that it would be safe to call .add() on it. Here it could just return what was passed in parameter? What do you think?

Line:60, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/NullStateValue.java -> Here it makes sense to simply throw an exception in all cases. While we could create a new Integer value from this, it would be a mess. Do we make a Integer or Long value? Do we start at 0 or 1? 

But then, it's weird if .add() works and increment() doesn't. Gah, dunno what to do with this!

Line:12, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/ITmfStateValue.java -> Don't add your name twice, it's not like a changelog.  Put a comma and add it after the previous line (wrapped on many lines if needed).

Line:65, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/StringStateValue.java -> see previous comment about parameter name

Line:64, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/IntegerStateValue.java -> the parameter is called "val" in the interface. It's not super duper important, but it's a bit easier to follow if they are called the same. Either "val" or "other" would be good.

Line:66, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/IntegerStateValue.java -> If it's just a null value, wouldn't it be simpler to just "return this"?

Line:68, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/IntegerStateValue.java -> Instead of this.unboxInt() you could just use "valueInt" directly. We are already in the integer class, so this would save us an extra try {}.

Line:74, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/IntegerStateValue.java -> > this.unboxInt()

here too

Line:64, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> see previous comment about parameter name

Line:66, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> this could be just "return this"

Line:68, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> same as with IntegerStateValue, you can use valueLong directly here.

Line:73, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statevalue/LongStateValue.java -> > this.unboxLong()

here too

Line:10, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statevalue/TmfStateValueTest.java -> You can keep the accent, it's all Unicode so it should be good now ;)  Up to you.

Line:230, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statevalue/TmfStateValueTest.java -> Perhaps you were doing this in the previous patch (I'm sorry I didn't look very closely to the tests yet ;) )  but JUnit4 offers a nice way to test for expected exceptions:

 xxx@xxx.xxx
  public void testAddLongToInt() throws StateValueTypeException {
    VALUE2.add(VALUE8);
  }

This will fail the test if the exception is not thrown. That way, the reason for the test failure will be more clear, "expected exception was not received" vs "fail() was called". This applies to the other tests below where you expect an exception.

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