You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/03/08 10:51:30 UTC

[incubator-plc4x] 01/08: javadoc and cleanup for amstcp header

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

sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit e6c3fc32ae0c9a9c7f21d4570d2281a2347f04ba
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Mar 8 09:05:31 2018 +0100

    javadoc and cleanup for amstcp header
---
 .../plc4x/java/ads/api/generic/AMSTCPHeader.java   | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java
index 8210203..01882c3 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/AMSTCPHeader.java
@@ -31,21 +31,31 @@ import static java.util.Objects.requireNonNull;
  */
 public class AMSTCPHeader implements ByteReadable {
 
+    /**
+     * These bytes must be set to 0.
+     */
     private final Reserved reserved;
 
+    /**
+     * This array contains the length of the data packet. It consists of the AMS-Header and the enclosed ADS data. The unit is bytes.
+     * is null if length is supplied by {@link #lengthSuppliers}.
+     */
     private final TcpLength tcpLength;
 
+    /**
+     * This array contains the length of the data packet. It consists of the AMS-Header and the enclosed ADS data. The unit is bytes.
+     * is null if length is supplied by {@link #tcpLength}.
+     */
     private final LengthSupplier[] lengthSuppliers;
 
     private AMSTCPHeader(TcpLength tcpLength) {
-        this.reserved = requireNonNull(Reserved.CONSTANT);
+        this.reserved = Reserved.CONSTANT;
         this.tcpLength = requireNonNull(tcpLength);
-        lengthSuppliers = null;
-
+        this.lengthSuppliers = null;
     }
 
     private AMSTCPHeader(LengthSupplier... lengthSuppliers) {
-        this.reserved = requireNonNull(Reserved.CONSTANT);
+        this.reserved = Reserved.CONSTANT;
         this.tcpLength = null;
         this.lengthSuppliers = requireNonNull(lengthSuppliers);
     }
@@ -114,8 +124,8 @@ public class AMSTCPHeader implements ByteReadable {
 
     @Override
     public int hashCode() {
-        int result = reserved != null ? reserved.hashCode() : 0;
-        result = 31 * result + (getTcpLength() != null ? getTcpLength().hashCode() : 0);
+        int result = reserved.hashCode();
+        result = 31 * result + getTcpLength().hashCode();
         return result;
     }
 

-- 
To stop receiving notification emails like this one, please contact
sruehl@apache.org.