Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

add feature sumSince to persistence extensions #376

Closed
wants to merge 1 commit into from
Closed

add feature sumSince to persistence extensions #376

wants to merge 1 commit into from

Conversation

J-N-K
Copy link
Contributor

@J-N-K J-N-K commented Jul 5, 2015

Signed-off-by: Jan N. Klug jan.n.klug@rub.de

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
while(it.hasNext()) {
State state = it.next().getState();
if (state instanceof DecimalType) {
sum += ((DecimalType) state).doubleValue();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use the (unprecise) double value here instead of summing up the (exact) BigDecimals?

@kaikreuzer
Copy link
Contributor

Thanks for this PR! It seems as if you do not have signed the CLA, right? Could you please do this? (see https://wiki.eclipse.org/Development_Resources/Contributing_via_Git#Eclipse_Foundation_Contributor_License_Agreement for instructions)

@kaikreuzer
Copy link
Contributor

CLA is there now, thanks! So I am only waiting for an answer on #376 (comment) now.

@J-N-K
Copy link
Contributor Author

J-N-K commented Jul 21, 2015

Because all other functions like averageSince do the same. Its about consistency. Sorry fot not coming back to this issue earlier. I did not receive your update.

@kaikreuzer
Copy link
Contributor

Because all other functions like averageSince do the same. Its about consistency.

Well, minimum and maximum work with the precise values. average obviously anyhow results in some "unprecise" value since it does floating point arithmetics. But a sum of exact values stays an exact value - hence I would expect here not having to deal with possible rounding issues etc. Since we have the precision, why not use it here?

@kaikreuzer
Copy link
Contributor

@J-N-K Would you be ok with using BigDecimals here and update the PR accordingly? We could then merge it.

@teichsta
Copy link
Contributor

it would be great if you could sync the change also against OH1. Thanks @J-N-K

@J-N-K
Copy link
Contributor Author

J-N-K commented Sep 13, 2015

Using BigDecimals is ok for me, but I will not be able to update this PR unless I have solved some more important issues for me.

@kaikreuzer
Copy link
Contributor

No worries, there's no need to rush.

@mccaffm
Copy link

mccaffm commented Oct 8, 2015

Is there a process to merge changes to the core OH1 with ESH. The persistence extensions seem to have had significant work done since the code was released to Eclipse. Or is it a case of having to pull request each OH1 core update ? you have to assume if there is a change in OH1 then its a requirement that a user wanted. Im not sure how migrating users from OH1 to OH2 will be feasible without ESH/OH2 having all the functionality of OH1. I personally make use of lastUpdate in rules on OH1, but ESH doesnt have this in its persistence extension, hence my question.am i barking up the wrong tree ? (or is that subtree :) )

@kaikreuzer
Copy link
Contributor

@mccaffm You are fully right, there must be no changes in the openHAB 1 runtime that are not reflected in Eclipse SmartHome as well as otherwise the backward compatibility will be lost.

To guarantee this, we communicated a long while ago that the openHAB 1 runtime is considered to be feature-frozen and only critical patches should be done to it. @teichsta tracks all changes that are done to the openHAB 1 core and makes sure that they also end up in Eclipse SmartHome, either by migrating them himself or by asking the contributor of the change to do so prior to closing/merging the issue in openHAB 1.

At least this is the agreed process. If you feel (and from your comment you seem to) that some features got lost on the way, please immediately tell @teichsta about it - the best way to do this is to (re-)open an issue in the openHAB 1 issue tracker and mark it as critical. Thanks!

@teichsta
Copy link
Contributor

teichsta commented Oct 8, 2015

@mccaffm any specific case you are referring to?

@mccaffm
Copy link

mccaffm commented Oct 8, 2015

Just compare the persistence extensions between oh1 and ESH. Unless I'm missing something lots of features are missing.

M

On 8 Oct 2015 21:52, at 21:52, "Thomas Eichstädt-Engelen" notifications@github.com wrote:

@mccaffm any specific case you are referring to?


Reply to this email directly or view it on GitHub:
#376 (comment)

@mccaffm
Copy link

mccaffm commented Oct 9, 2015

Am I going mad then ?? it wouldn't be the first time

@teichsta
Copy link
Contributor

teichsta commented Oct 9, 2015

Am I going mad then ??

no, you are right, there is a diff. Will have a look and come back to …

Update: it looks like #1471 and #2232 didn't find their way to ESH. @clinique and @edog1973 could you please also contribute your changes to ESH or @J-N-K could incorporate their enhancements in this PR as well? Thanks in advance, Thomas E.-E.

@clinique
Copy link
Contributor

@teichsta : PR #500 to push lastUpdate, deltaSince and evolutionRate to ESH

@teichsta
Copy link
Contributor

PR #500 to push lastUpdate, deltaSince and evolutionRate to ESH

great, thanks!

@kaikreuzer
Copy link
Contributor

@J-N-K #500 has been merged now, so the classes should be in sync with openHAB 1 again. Could you now please update this PR and finalize it, so that it can be merged? Thanks!

@kaikreuzer
Copy link
Contributor

@J-N-K Could you update this PR?

@J-N-K J-N-K closed this Feb 23, 2016
watou added a commit to watou/smarthome that referenced this pull request Jul 11, 2016
* added sumSince (fixes eclipse-archived#1843 replaces eclipse-archived#376)
* changed evolutionRate to use BigDecimal instead of double
* changed deltaSince to use BigDecimal instead of double
* added check in evolutionRate method to avoid divide-by-zero error
* updated all JavaDoc headers to reflect the odd variety of return values and their reasons, in hopes of spurring discussion as to whether and how to tighten and simplify the PersistenceExtensions.

Also-By: Jan N. Klug jan.n.klug@rub.de
Signed-off-by: John Cocula <john@cocula.com>
maggu2810 pushed a commit that referenced this pull request Jul 12, 2016
* changed averageSince to use BigDecimal instead of double
* added sumSince (fixes #1843 replaces #376)
* changed evolutionRate to use BigDecimal instead of double
* changed deltaSince to use BigDecimal instead of double
* added check in evolutionRate method to avoid divide-by-zero error
* updated all JavaDoc headers to reflect the odd variety of return values and their reasons, in hopes of spurring discussion as to whether and how to tighten and simplify the PersistenceExtensions.

Also-By: Jan N. Klug jan.n.klug@rub.de
Signed-off-by: John Cocula <john@cocula.com>

* Changed modifier order to recommended order per @maggu2810

Signed-off-by: John Cocula <john@cocula.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants