Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/25#discussion_r56561498
  
    --- Diff: 
samples/topology/src/main/java/quarks/samples/topology/CombiningStreamsProcessingResults.java
 ---
    @@ -62,32 +61,28 @@ public static void main(String[] args) throws Exception 
{
                     .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) {
    --- End diff --
    
    Unrelated to this change but it jumps out at me that the code might be 
clearer and more compact if you fetched the two values into local variables 
first and then used those variables rather than getting each value multiple 
times.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to