You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2016/03/22 13:47:21 UTC
[1/3] incubator-quarks git commit: Update split to use lambda function
Repository: incubator-quarks
Updated Branches:
refs/heads/master eb9153184 -> e045317bd
Update split to use lambda function
Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/a1e7b851
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/a1e7b851
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/a1e7b851
Branch: refs/heads/master
Commit: a1e7b85141d570a6ba9be53a1bc353a3090e5e84
Parents: da1e7e9
Author: Queenie Ma <qu...@gmail.com>
Authored: Thu Mar 17 11:51:07 2016 -0700
Committer: Queenie Ma <qu...@gmail.com>
Committed: Thu Mar 17 13:17:27 2016 -0700
----------------------------------------------------------------------
.../CombiningStreamsProcessingResults.java | 49 +++++++++-----------
1 file changed, 22 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/a1e7b851/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
----------------------------------------------------------------------
diff --git a/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java b/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
index e6f6810..67ca84d 100644
--- a/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
+++ b/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
@@ -25,7 +25,6 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import quarks.console.server.HttpServer;
-import quarks.function.ToIntFunction;
import quarks.providers.development.DevelopmentProvider;
import quarks.providers.direct.DirectProvider;
import quarks.samples.utils.sensor.HeartMonitorSensor;
@@ -62,32 +61,28 @@ public class CombiningStreamsProcessingResults {
.filter(tuple -> tuple.get("Systolic") < 200 && tuple.get("Diastolic") < 130);
// Split the stream by blood pressure category
- List<TStream<Map<String, Integer>>> categories = readings.split(6, new ToIntFunction<Map<String, Integer>>() {
- private static final long serialVersionUID = 1L;
- @Override
- public int applyAsInt(Map<String, Integer> tuple) {
- if (tuple.get("Systolic") < 120 && tuple.get("Diastolic") < 80) {
- // Normal
- return 0;
- } else if ((tuple.get("Systolic") >= 120 && tuple.get("Systolic") <= 139) ||
- (tuple.get("Diastolic") >= 80 && tuple.get("Diastolic") <= 89)) {
- // Prehypertension
- return 1;
- } else if ((tuple.get("Systolic") >= 140 && tuple.get("Systolic") <= 159) ||
- (tuple.get("Diastolic") >= 90 && tuple.get("Diastolic") <= 99)) {
- // High Blood Pressure (Hypertension) Stage 1
- return 2;
- } else if ((tuple.get("Systolic") >= 160 && tuple.get("Systolic") <= 179) ||
- (tuple.get("Diastolic") >= 100 && tuple.get("Diastolic") <= 109)) {
- // High Blood Pressure (Hypertension) Stage 2
- return 3;
- } else if (tuple.get("Systolic") >= 180 && tuple.get("Diastolic") >= 110) {
- // Hypertensive Crisis
- return 4;
- } else {
- // Invalid
- return -1;
- }
+ List<TStream<Map<String, Integer>>> categories = readings.split(6, tuple -> {
+ if (tuple.get("Systolic") < 120 && tuple.get("Diastolic") < 80) {
+ // Normal
+ return 0;
+ } else if ((tuple.get("Systolic") >= 120 && tuple.get("Systolic") <= 139) ||
+ (tuple.get("Diastolic") >= 80 && tuple.get("Diastolic") <= 89)) {
+ // Prehypertension
+ return 1;
+ } else if ((tuple.get("Systolic") >= 140 && tuple.get("Systolic") <= 159) ||
+ (tuple.get("Diastolic") >= 90 && tuple.get("Diastolic") <= 99)) {
+ // High Blood Pressure (Hypertension) Stage 1
+ return 2;
+ } else if ((tuple.get("Systolic") >= 160 && tuple.get("Systolic") <= 179) ||
+ (tuple.get("Diastolic") >= 100 && tuple.get("Diastolic") <= 109)) {
+ // High Blood Pressure (Hypertension) Stage 2
+ return 3;
+ } else if (tuple.get("Systolic") >= 180 && tuple.get("Diastolic") >= 110) {
+ // Hypertensive Crisis
+ return 4;
+ } else {
+ // Invalid
+ return -1;
}
});
[3/3] incubator-quarks git commit: Merge pull request #25
Posted by dl...@apache.org.
Merge pull request #25
This closes #25
Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/e045317b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/e045317b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/e045317b
Branch: refs/heads/master
Commit: e045317bde8569220e667bb9d563d114e482a6c4
Parents: eb91531 0378b56
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Tue Mar 22 08:47:11 2016 -0400
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Tue Mar 22 08:47:11 2016 -0400
----------------------------------------------------------------------
.../CombiningStreamsProcessingResults.java | 48 +++++++++-----------
1 file changed, 21 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
[2/3] incubator-quarks git commit: Clean up split code
Posted by dl...@apache.org.
Clean up split code
Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/0378b56d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/0378b56d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/0378b56d
Branch: refs/heads/master
Commit: 0378b56de132040424bf3ae13b7397862f57ca7c
Parents: a1e7b85
Author: Queenie Ma <qu...@gmail.com>
Authored: Thu Mar 17 12:17:57 2016 -0700
Committer: Queenie Ma <qu...@gmail.com>
Committed: Thu Mar 17 13:17:42 2016 -0700
----------------------------------------------------------------------
.../topology/CombiningStreamsProcessingResults.java | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/0378b56d/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
----------------------------------------------------------------------
diff --git a/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java b/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
index 67ca84d..6005c5b 100644
--- a/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
+++ b/samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
@@ -62,22 +62,21 @@ public class CombiningStreamsProcessingResults {
// Split the stream by blood pressure category
List<TStream<Map<String, Integer>>> categories = readings.split(6, tuple -> {
- if (tuple.get("Systolic") < 120 && tuple.get("Diastolic") < 80) {
+ int s = tuple.get("Systolic");
+ int d = tuple.get("Diastolic");
+ if (s < 120 && d < 80) {
// Normal
return 0;
- } else if ((tuple.get("Systolic") >= 120 && tuple.get("Systolic") <= 139) ||
- (tuple.get("Diastolic") >= 80 && tuple.get("Diastolic") <= 89)) {
+ } else if ((s >= 120 && s <= 139) || (d >= 80 && d <= 89)) {
// Prehypertension
return 1;
- } else if ((tuple.get("Systolic") >= 140 && tuple.get("Systolic") <= 159) ||
- (tuple.get("Diastolic") >= 90 && tuple.get("Diastolic") <= 99)) {
+ } else if ((s >= 140 && s <= 159) || (d >= 90 && d <= 99)) {
// High Blood Pressure (Hypertension) Stage 1
return 2;
- } else if ((tuple.get("Systolic") >= 160 && tuple.get("Systolic") <= 179) ||
- (tuple.get("Diastolic") >= 100 && tuple.get("Diastolic") <= 109)) {
+ } else if ((s >= 160 && s <= 179) || (d >= 100 && d <= 109)) {
// High Blood Pressure (Hypertension) Stage 2
return 3;
- } else if (tuple.get("Systolic") >= 180 && tuple.get("Diastolic") >= 110) {
+ } else if (s >= 180 && d >= 110) {
// Hypertensive Crisis
return 4;
} else {