You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/05/08 08:28:15 UTC

[incubator-streampipes-extensions] branch dev updated: Fix NameLabeler to work with double values

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git


The following commit(s) were added to refs/heads/dev by this push:
     new a8e3ef0  Fix NameLabeler to work with double values
     new 0dddf4e  Merge pull request #46 from mohanvive/bug-fix
a8e3ef0 is described below

commit a8e3ef029c92c8da51599d6cbd87746922a2a515
Author: mohanadarshan <mo...@gmail.com>
AuthorDate: Sat May 8 13:06:28 2021 +0530

    Fix NameLabeler to work with double values
---
 .../state/labeler/buffer/StateBufferLabelerController.java       | 4 ++--
 .../state/labeler/buffer/StateBufferLabelerParameters.java       | 8 ++++----
 .../jvm/processor/state/labeler/model/StatementUtils.java        | 3 ++-
 .../processor/state/labeler/number/NumberLabelerController.java  | 4 ++--
 .../processor/state/labeler/number/NumberLabelerParameters.java  | 9 +++++----
 5 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerController.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerController.java
index 3ca5268..16c85bf 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerController.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerController.java
@@ -104,14 +104,14 @@ public class StateBufferLabelerController extends StandaloneEventProcessingDecla
     String labelName = extractor.textParameter(LABEL_NAME);
 
     List<StaticPropertyGroup> groupItems = extractor.collectionMembersAsGroup(LABEL_COLLECTION_ID);
-    List<Integer> numberValues = groupItems
+    List<Double> numberValues = groupItems
             .stream()
             .map(group -> (
                     extractor
                             .extractGroupMember(NUMBER_VALUE_ID, group)
                             .as(FreeTextStaticProperty.class))
                     .getValue())
-            .map(Integer::parseInt)
+            .map(Double::parseDouble)
             .collect(Collectors.toList());
 
     List<String> labelStrings = groupItems
diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerParameters.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerParameters.java
index 002836c..10543bb 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerParameters.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/buffer/StateBufferLabelerParameters.java
@@ -30,7 +30,7 @@ public class StateBufferLabelerParameters extends EventProcessorBindingParams {
     private String stateFilter;
     private String selectedOperation;
     private String labelName;
-    private List<Integer> numberValues;
+    private List<Double> numberValues;
     private List<String> labelStrings;
     private List<String> comparators;
 
@@ -40,7 +40,7 @@ public class StateBufferLabelerParameters extends EventProcessorBindingParams {
                                         String stateFilter,
                                         String selectedOperation,
                                         String labelName,
-                                        List<Integer> numberValues,
+                                        List<Double> numberValues,
                                         List<String> labelStrings,
                                         List<String> comparators) {
         super(graph);
@@ -86,11 +86,11 @@ public class StateBufferLabelerParameters extends EventProcessorBindingParams {
         this.stateProperty = stateProperty;
     }
 
-    public List<Integer> getNumberValues() {
+    public List<Double> getNumberValues() {
         return numberValues;
     }
 
-    public void setNumberValues(List<Integer> numberValues) {
+    public void setNumberValues(List<Double> numberValues) {
         this.numberValues = numberValues;
     }
 
diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/model/StatementUtils.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/model/StatementUtils.java
index 74a0dd3..93d5db5 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/model/StatementUtils.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/model/StatementUtils.java
@@ -59,7 +59,8 @@ public class StatementUtils {
 
 
 
-    public static List<Statement> getStatements(List<Integer> numberValues, List<String> labelStrings, List<String> comparators) throws SpRuntimeException {
+    public static List<Statement> getStatements(List<Double> numberValues, List<String> labelStrings,
+                                                List<String> comparators) throws SpRuntimeException {
 
         List<Statement> result = new ArrayList<>();
 
diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerController.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerController.java
index 52a457e..63bbba3 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerController.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerController.java
@@ -86,14 +86,14 @@ public class NumberLabelerController extends StandaloneEventProcessingDeclarer<N
 
     List<StaticPropertyGroup> groupItems = extractor.collectionMembersAsGroup(LABEL_COLLECTION_ID);
 
-    List<Integer> numberValues = groupItems
+    List<Double> numberValues = groupItems
             .stream()
             .map(group -> (
                     extractor
                     .extractGroupMember(NUMBER_VALUE_ID, group)
                     .as(FreeTextStaticProperty.class))
                     .getValue())
-            .map(Integer::parseInt)
+            .map(Double::parseDouble)
             .collect(Collectors.toList());
 
     List<String> labelStrings = groupItems
diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerParameters.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerParameters.java
index 424f3a7..260557f 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerParameters.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/state/labeler/number/NumberLabelerParameters.java
@@ -28,11 +28,12 @@ public class NumberLabelerParameters extends EventProcessorBindingParams {
     private String sensorListValueProperty;
     private String labelName;
 
-    private List<Integer> numberValues;
+    private List<Double> numberValues;
     private List<String> labelStrings;
     private List<String> comparators;
 
-    public NumberLabelerParameters(DataProcessorInvocation graph, String sensorListValueProperty, String labelName, List<Integer> numberValues, List<String> labelStrings, List<String> comparators) {
+    public NumberLabelerParameters(DataProcessorInvocation graph, String sensorListValueProperty, String labelName,
+                                   List<Double> numberValues, List<String> labelStrings, List<String> comparators) {
         super(graph);
         this.sensorListValueProperty = sensorListValueProperty;
         this.labelName = labelName;
@@ -49,11 +50,11 @@ public class NumberLabelerParameters extends EventProcessorBindingParams {
         this.sensorListValueProperty = sensorListValueProperty;
     }
 
-    public List<Integer> getNumberValues() {
+    public List<Double> getNumberValues() {
         return numberValues;
     }
 
-    public void setNumberValues(List<Integer> numberValues) {
+    public void setNumberValues(List<Double> numberValues) {
         this.numberValues = numberValues;
     }