From aec07c09892fda2de18e92729f000d07226c3da6 Mon Sep 17 00:00:00 2001 From: seayar <602174096@qq.com> Date: Fri, 23 Aug 2019 11:07:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9modbus=20POM=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8Aresults=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + pom.xml | 102 ++----------------- src/com/serotonin/modbus4j/BatchResults.java | 16 ++- 3 files changed, 23 insertions(+), 97 deletions(-) diff --git a/.gitignore b/.gitignore index b83d222..4e36687 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target/ +.settings/ +.idea/ diff --git a/pom.xml b/pom.xml index 0e6d926..10e600b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,81 +1,13 @@ - + 4.0.0 com.infiniteautomation modbus4j - 3.0.6-SNAPSHOT + 3.0.6 Modbus4j Library - UTF-8 + UTF-8 - - src - src_test - - - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-source-plugin - 3.0.1 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.1 - - true - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.5.1 - - - default-deploy - deploy - - deploy - - - - - ias-releases - https://maven.mangoautomation.net/ - true - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins - maven-scm-plugin - 1.9.5 - - - - v@{project.version} - - - - org.apache.commons @@ -88,24 +20,10 @@ 1.1.1 - - https://github.com/infiniteautomation/modbus4j/issues - github - - - https://github.com/infiniteautomation/modbus4j - scm:git:https://github.com/infiniteautomation/modbus4j.git - scm:git:[push=]https://github.com/infiniteautomation/modbus4j.git[fetch=]https://github.com/infiniteautomation/modbus4j.git - HEAD - - - - ias-snapshots - https://maven.mangoautomation.net/repository/ias-snapshot/ - - - ias-releases - https://maven.mangoautomation.net/repository/ias-release/ - - + + + thirdparty + http://maven.seayar.tk/nexus/content/repositories/thirdparty/ + + \ No newline at end of file diff --git a/src/com/serotonin/modbus4j/BatchResults.java b/src/com/serotonin/modbus4j/BatchResults.java index e4fd171..a4882c4 100644 --- a/src/com/serotonin/modbus4j/BatchResults.java +++ b/src/com/serotonin/modbus4j/BatchResults.java @@ -5,12 +5,12 @@ * * Copyright (C) 2006-2011 Serotonin Software Technologies Inc. http://serotoninsoftware.com * @author Matthew Lohbihler - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -30,18 +30,22 @@ * @version 5.0.0 */ public class BatchResults { - private final Map data = new HashMap<>(); + protected final Map data = new HashMap<>(); /** *

addResult.

* - * @param key a K object. + * @param key a K object. * @param value a {@link java.lang.Object} object. */ public void addResult(K key, Object value) { data.put(key, value); } + public void addBatchResults(BatchResults results) { + this.data.putAll(results.data); + } + /** *

getValue.

* @@ -92,7 +96,9 @@ public Float getFloatValue(K key) { return (Float) getValue(key); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public String toString() { return data.toString(); From 46ad2ad2bf176c81bcb80dc8df4c51217552e07e Mon Sep 17 00:00:00 2001 From: seayar <602174096@qq.com> Date: Fri, 5 Jun 2020 14:30:55 +0800 Subject: [PATCH 2/2] #change: src/com/serotonin/modbus4j BatchResults.java: Add result sets in bulk #change: the gitignore fit the idea ide. --- pom.xml | 102 +++++++++++++++++-- src/com/serotonin/modbus4j/BatchResults.java | 16 +-- 2 files changed, 101 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index 10e600b..0e6d926 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,81 @@ - + 4.0.0 com.infiniteautomation modbus4j - 3.0.6 + 3.0.6-SNAPSHOT Modbus4j Library - UTF-8 + UTF-8 + + src + src_test + + + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.1 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.5.1 + + + default-deploy + deploy + + deploy + + + + + ias-releases + https://maven.mangoautomation.net/ + true + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + + org.apache.maven.plugins + maven-scm-plugin + 1.9.5 + + + + v@{project.version} + + + + org.apache.commons @@ -20,10 +88,24 @@ 1.1.1 - - - thirdparty - http://maven.seayar.tk/nexus/content/repositories/thirdparty/ - - + + https://github.com/infiniteautomation/modbus4j/issues + github + + + https://github.com/infiniteautomation/modbus4j + scm:git:https://github.com/infiniteautomation/modbus4j.git + scm:git:[push=]https://github.com/infiniteautomation/modbus4j.git[fetch=]https://github.com/infiniteautomation/modbus4j.git + HEAD + + + + ias-snapshots + https://maven.mangoautomation.net/repository/ias-snapshot/ + + + ias-releases + https://maven.mangoautomation.net/repository/ias-release/ + + \ No newline at end of file diff --git a/src/com/serotonin/modbus4j/BatchResults.java b/src/com/serotonin/modbus4j/BatchResults.java index a4882c4..d3210de 100644 --- a/src/com/serotonin/modbus4j/BatchResults.java +++ b/src/com/serotonin/modbus4j/BatchResults.java @@ -5,12 +5,12 @@ * * Copyright (C) 2006-2011 Serotonin Software Technologies Inc. http://serotoninsoftware.com * @author Matthew Lohbihler - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -30,18 +30,22 @@ * @version 5.0.0 */ public class BatchResults { - protected final Map data = new HashMap<>(); + private final Map data = new HashMap<>(); /** *

addResult.

* - * @param key a K object. + * @param key a K object. * @param value a {@link java.lang.Object} object. */ public void addResult(K key, Object value) { data.put(key, value); } + /** + *

Add result sets in bulk

+ * @param results Batch results + */ public void addBatchResults(BatchResults results) { this.data.putAll(results.data); } @@ -96,9 +100,7 @@ public Float getFloatValue(K key) { return (Float) getValue(key); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ @Override public String toString() { return data.toString();