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:22 UTC

[2/3] incubator-quarks git commit: Clean up split code

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 {