From 62325bf0265562a3e6083948198995fb58bbbdd7 Mon Sep 17 00:00:00 2001
From: Mike Bailey <jmbailey@nps.edu>
Date: Thu, 5 Sep 2019 16:14:53 -0700
Subject: [PATCH] Changes in comments and PduFactory

---
 .../edu/nps/moves/dis7/ActionRequestPdu.java  |   2 +-
 .../edu/nps/moves/dis7/ActionResponsePdu.java |   2 +-
 .../edu/nps/moves/dis7/AggregateStatePdu.java |   4 +-
 .../edu/nps/moves/dis7/CommentPdu.java        |  61 +-----
 .../edu/nps/moves/dis7/CommentRPdu.java       |  59 +-----
 src-generated/edu/nps/moves/dis7/DataPdu.java |   2 +-
 .../edu/nps/moves/dis7/DataQueryPdu.java      |   2 +-
 .../edu/nps/moves/dis7/EventReportPdu.java    |   2 +-
 .../edu/nps/moves/dis7/SetDataPdu.java        |   2 +-
 .../edu/nps/moves/dis7/UAEmitter.java         |   1 +
 src/edu/nps/moves/dis7/util/PduFactory.java   | 196 +++++++++++++++++-
 test/edu/nps/moves/dis7/CommentPdusTest.java  | 108 ++++++++++
 12 files changed, 316 insertions(+), 125 deletions(-)
 create mode 100644 test/edu/nps/moves/dis7/CommentPdusTest.java

diff --git a/src-generated/edu/nps/moves/dis7/ActionRequestPdu.java b/src-generated/edu/nps/moves/dis7/ActionRequestPdu.java
index da72ea63b8..bb160d13b3 100644
--- a/src-generated/edu/nps/moves/dis7/ActionRequestPdu.java
+++ b/src-generated/edu/nps/moves/dis7/ActionRequestPdu.java
@@ -24,7 +24,7 @@ public class ActionRequestPdu extends SimulationManagementFamilyPdu implements S
    /** Number of fixed datum records */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** variable length list of fixed datums */
diff --git a/src-generated/edu/nps/moves/dis7/ActionResponsePdu.java b/src-generated/edu/nps/moves/dis7/ActionResponsePdu.java
index 73174f7a1d..c20f312612 100644
--- a/src-generated/edu/nps/moves/dis7/ActionResponsePdu.java
+++ b/src-generated/edu/nps/moves/dis7/ActionResponsePdu.java
@@ -24,7 +24,7 @@ public class ActionResponsePdu extends SimulationManagementFamilyPdu implements
    /** Number of fixed datum records */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** fixed length list of fixed datums */
diff --git a/src-generated/edu/nps/moves/dis7/AggregateStatePdu.java b/src-generated/edu/nps/moves/dis7/AggregateStatePdu.java
index 62f6b9c474..7e60675e32 100644
--- a/src-generated/edu/nps/moves/dis7/AggregateStatePdu.java
+++ b/src-generated/edu/nps/moves/dis7/AggregateStatePdu.java
@@ -54,7 +54,7 @@ public class AggregateStatePdu extends EntityManagementFamilyPdu implements Seri
    /** number of silent aggregate types */
    protected short  numberOfSilentAggregateTypes;
 
-   /** number of silent entity types */
+   /** Number of silent entity types, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected short  numberOfSilentEntityTypes;
 
    /** aggregates  list */
@@ -71,7 +71,7 @@ public class AggregateStatePdu extends EntityManagementFamilyPdu implements Seri
    /** silent entity types */
    protected List< EntityType > silentEntitySystemList = new ArrayList< EntityType >();
  
-   /** number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** variableDatums */
diff --git a/src-generated/edu/nps/moves/dis7/CommentPdu.java b/src-generated/edu/nps/moves/dis7/CommentPdu.java
index 331ed2ea5d..a7776c0411 100644
--- a/src-generated/edu/nps/moves/dis7/CommentPdu.java
+++ b/src-generated/edu/nps/moves/dis7/CommentPdu.java
@@ -15,15 +15,12 @@ import edu.nps.moves.dis7.enumerations.*;
  */
 public class CommentPdu extends SimulationManagementFamilyPdu implements Serializable
 {
-   /** Number of fixed datum records */
+   /** Number of fixed datum records, not used in this Pdu */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
-   /** variable length list of fixed datums */
-   protected List< FixedDatum > fixedDatums = new ArrayList< FixedDatum >();
- 
    /** variable length list of variable length datums */
    protected List< VariableDatum > variableDatums = new ArrayList< VariableDatum >();
  
@@ -42,11 +39,6 @@ public int getMarshalledSize()
    marshalSize = super.getMarshalledSize();
    marshalSize += 4;  // numberOfFixedDatumRecords
    marshalSize += 4;  // numberOfVariableDatumRecords
-   for(int idx=0; idx < fixedDatums.size(); idx++)
-   {
-        FixedDatum listElement = fixedDatums.get(idx);
-        marshalSize += listElement.getMarshalledSize();
-   }
    for(int idx=0; idx < variableDatums.size(); idx++)
    {
         VariableDatum listElement = variableDatums.get(idx);
@@ -57,19 +49,6 @@ public int getMarshalledSize()
 }
 
 
-/** Setter for {@link CommentPdu#fixedDatums}*/
-public CommentPdu setFixedDatums(List<FixedDatum> pFixedDatums)
-{
-    fixedDatums = pFixedDatums;
-    return this;
-}
-
-/** Getter for {@link CommentPdu#fixedDatums}*/
-public List<FixedDatum> getFixedDatums()
-{
-    return fixedDatums; 
-}
-
 /** Setter for {@link CommentPdu#variableDatums}*/
 public CommentPdu setVariableDatums(List<VariableDatum> pVariableDatums)
 {
@@ -93,16 +72,9 @@ public void marshal(DataOutputStream dos) throws Exception
     super.marshal(dos);
     try 
     {
-       dos.writeInt( (int)fixedDatums.size());
+       dos.writeInt( (int)numberOfFixedDatumRecords);
        dos.writeInt( (int)variableDatums.size());
 
-       for(int idx = 0; idx < fixedDatums.size(); idx++)
-       {
-            FixedDatum aFixedDatum = fixedDatums.get(idx);
-            aFixedDatum.marshal(dos);
-       }
-
-
        for(int idx = 0; idx < variableDatums.size(); idx++)
        {
             VariableDatum aVariableDatum = variableDatums.get(idx);
@@ -133,13 +105,6 @@ public int unmarshal(DataInputStream dis) throws Exception
         uPosition += 4;
         numberOfVariableDatumRecords = dis.readInt();
         uPosition += 4;
-        for(int idx = 0; idx < numberOfFixedDatumRecords; idx++)
-        {
-            FixedDatum anX = new FixedDatum();
-            uPosition += anX.unmarshal(dis);
-            fixedDatums.add(anX);
-        }
-
         for(int idx = 0; idx < numberOfVariableDatumRecords; idx++)
         {
             VariableDatum anX = new VariableDatum();
@@ -166,16 +131,9 @@ public int unmarshal(DataInputStream dis) throws Exception
 public void marshal(java.nio.ByteBuffer buff) throws Exception
 {
    super.marshal(buff);
-   buff.putInt( (int)fixedDatums.size());
+   buff.putInt( (int)numberOfFixedDatumRecords);
    buff.putInt( (int)variableDatums.size());
 
-   for(int idx = 0; idx < fixedDatums.size(); idx++)
-   {
-        FixedDatum aFixedDatum = (FixedDatum)fixedDatums.get(idx);
-        aFixedDatum.marshal(buff);
-   }
-
-
    for(int idx = 0; idx < variableDatums.size(); idx++)
    {
         VariableDatum aVariableDatum = (VariableDatum)variableDatums.get(idx);
@@ -198,13 +156,6 @@ public int unmarshal(java.nio.ByteBuffer buff) throws Exception
 
     numberOfFixedDatumRecords = buff.getInt();
     numberOfVariableDatumRecords = buff.getInt();
-    for(int idx = 0; idx < numberOfFixedDatumRecords; idx++)
-    {
-    FixedDatum anX = new FixedDatum();
-    anX.unmarshal(buff);
-    fixedDatums.add(anX);
-    }
-
     for(int idx = 0; idx < numberOfVariableDatumRecords; idx++)
     {
     VariableDatum anX = new VariableDatum();
@@ -241,10 +192,6 @@ public int unmarshal(java.nio.ByteBuffer buff) throws Exception
      final CommentPdu rhs = (CommentPdu)obj;
 
 
-     for(int idx = 0; idx < fixedDatums.size(); idx++)
-        if( ! ( fixedDatums.get(idx).equals(rhs.fixedDatums.get(idx)))) ivarsEqual = false;
-
-
      for(int idx = 0; idx < variableDatums.size(); idx++)
         if( ! ( variableDatums.get(idx).equals(rhs.variableDatums.get(idx)))) ivarsEqual = false;
 
diff --git a/src-generated/edu/nps/moves/dis7/CommentRPdu.java b/src-generated/edu/nps/moves/dis7/CommentRPdu.java
index 6294f59501..f2309c53a1 100644
--- a/src-generated/edu/nps/moves/dis7/CommentRPdu.java
+++ b/src-generated/edu/nps/moves/dis7/CommentRPdu.java
@@ -15,15 +15,12 @@ import edu.nps.moves.dis7.enumerations.*;
  */
 public class CommentRPdu extends SimulationManagementWithReliabilityFamilyPdu implements Serializable
 {
-   /** Fixed datum record count */
+   /** Fixed datum record count, not used in this Pdu */
    protected int  numberOfFixedDatumRecords;
 
    /** variable datum record count */
    protected int  numberOfVariableDatumRecords;
 
-   /** Fixed datum records */
-   protected List< FixedDatum > fixedDatumRecords = new ArrayList< FixedDatum >();
- 
    /** Variable datum records */
    protected List< VariableDatum > variableDatumRecords = new ArrayList< VariableDatum >();
  
@@ -42,11 +39,6 @@ public int getMarshalledSize()
    marshalSize = super.getMarshalledSize();
    marshalSize += 4;  // numberOfFixedDatumRecords
    marshalSize += 4;  // numberOfVariableDatumRecords
-   for(int idx=0; idx < fixedDatumRecords.size(); idx++)
-   {
-        FixedDatum listElement = fixedDatumRecords.get(idx);
-        marshalSize += listElement.getMarshalledSize();
-   }
    for(int idx=0; idx < variableDatumRecords.size(); idx++)
    {
         VariableDatum listElement = variableDatumRecords.get(idx);
@@ -57,19 +49,6 @@ public int getMarshalledSize()
 }
 
 
-/** Setter for {@link CommentRPdu#fixedDatumRecords}*/
-public CommentRPdu setFixedDatumRecords(List<FixedDatum> pFixedDatumRecords)
-{
-    fixedDatumRecords = pFixedDatumRecords;
-    return this;
-}
-
-/** Getter for {@link CommentRPdu#fixedDatumRecords}*/
-public List<FixedDatum> getFixedDatumRecords()
-{
-    return fixedDatumRecords; 
-}
-
 /** Setter for {@link CommentRPdu#variableDatumRecords}*/
 public CommentRPdu setVariableDatumRecords(List<VariableDatum> pVariableDatumRecords)
 {
@@ -93,16 +72,9 @@ public void marshal(DataOutputStream dos) throws Exception
     super.marshal(dos);
     try 
     {
-       dos.writeInt( (int)fixedDatumRecords.size());
+       dos.writeInt( (int)numberOfFixedDatumRecords);
        dos.writeInt( (int)variableDatumRecords.size());
 
-       for(int idx = 0; idx < fixedDatumRecords.size(); idx++)
-       {
-            FixedDatum aFixedDatum = fixedDatumRecords.get(idx);
-            aFixedDatum.marshal(dos);
-       }
-
-
        for(int idx = 0; idx < variableDatumRecords.size(); idx++)
        {
             VariableDatum aVariableDatum = variableDatumRecords.get(idx);
@@ -133,13 +105,6 @@ public int unmarshal(DataInputStream dis) throws Exception
         uPosition += 4;
         numberOfVariableDatumRecords = dis.readInt();
         uPosition += 4;
-        for(int idx = 0; idx < numberOfFixedDatumRecords; idx++)
-        {
-            FixedDatum anX = new FixedDatum();
-            uPosition += anX.unmarshal(dis);
-            fixedDatumRecords.add(anX);
-        }
-
         for(int idx = 0; idx < numberOfVariableDatumRecords; idx++)
         {
             VariableDatum anX = new VariableDatum();
@@ -166,16 +131,9 @@ public int unmarshal(DataInputStream dis) throws Exception
 public void marshal(java.nio.ByteBuffer buff) throws Exception
 {
    super.marshal(buff);
-   buff.putInt( (int)fixedDatumRecords.size());
+   buff.putInt( (int)numberOfFixedDatumRecords);
    buff.putInt( (int)variableDatumRecords.size());
 
-   for(int idx = 0; idx < fixedDatumRecords.size(); idx++)
-   {
-        FixedDatum aFixedDatum = (FixedDatum)fixedDatumRecords.get(idx);
-        aFixedDatum.marshal(buff);
-   }
-
-
    for(int idx = 0; idx < variableDatumRecords.size(); idx++)
    {
         VariableDatum aVariableDatum = (VariableDatum)variableDatumRecords.get(idx);
@@ -198,13 +156,6 @@ public int unmarshal(java.nio.ByteBuffer buff) throws Exception
 
     numberOfFixedDatumRecords = buff.getInt();
     numberOfVariableDatumRecords = buff.getInt();
-    for(int idx = 0; idx < numberOfFixedDatumRecords; idx++)
-    {
-    FixedDatum anX = new FixedDatum();
-    anX.unmarshal(buff);
-    fixedDatumRecords.add(anX);
-    }
-
     for(int idx = 0; idx < numberOfVariableDatumRecords; idx++)
     {
     VariableDatum anX = new VariableDatum();
@@ -241,10 +192,6 @@ public int unmarshal(java.nio.ByteBuffer buff) throws Exception
      final CommentRPdu rhs = (CommentRPdu)obj;
 
 
-     for(int idx = 0; idx < fixedDatumRecords.size(); idx++)
-        if( ! ( fixedDatumRecords.get(idx).equals(rhs.fixedDatumRecords.get(idx)))) ivarsEqual = false;
-
-
      for(int idx = 0; idx < variableDatumRecords.size(); idx++)
         if( ! ( variableDatumRecords.get(idx).equals(rhs.variableDatumRecords.get(idx)))) ivarsEqual = false;
 
diff --git a/src-generated/edu/nps/moves/dis7/DataPdu.java b/src-generated/edu/nps/moves/dis7/DataPdu.java
index 4ce1362cb0..e73d66f853 100644
--- a/src-generated/edu/nps/moves/dis7/DataPdu.java
+++ b/src-generated/edu/nps/moves/dis7/DataPdu.java
@@ -24,7 +24,7 @@ public class DataPdu extends SimulationManagementFamilyPdu implements Serializab
    /** Number of fixed datum records */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** variable length list of fixed datums */
diff --git a/src-generated/edu/nps/moves/dis7/DataQueryPdu.java b/src-generated/edu/nps/moves/dis7/DataQueryPdu.java
index 6f49128071..079a37edf3 100644
--- a/src-generated/edu/nps/moves/dis7/DataQueryPdu.java
+++ b/src-generated/edu/nps/moves/dis7/DataQueryPdu.java
@@ -24,7 +24,7 @@ public class DataQueryPdu extends SimulationManagementFamilyPdu implements Seria
    /** Number of fixed datum records */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** variable length list of fixed datums */
diff --git a/src-generated/edu/nps/moves/dis7/EventReportPdu.java b/src-generated/edu/nps/moves/dis7/EventReportPdu.java
index 848fd2a992..225f64a9f3 100644
--- a/src-generated/edu/nps/moves/dis7/EventReportPdu.java
+++ b/src-generated/edu/nps/moves/dis7/EventReportPdu.java
@@ -24,7 +24,7 @@ public class EventReportPdu extends SimulationManagementFamilyPdu implements Ser
    /** Number of fixed datum records */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** variable length list of fixed datums */
diff --git a/src-generated/edu/nps/moves/dis7/SetDataPdu.java b/src-generated/edu/nps/moves/dis7/SetDataPdu.java
index a3d28f6d7f..6817d1aac1 100644
--- a/src-generated/edu/nps/moves/dis7/SetDataPdu.java
+++ b/src-generated/edu/nps/moves/dis7/SetDataPdu.java
@@ -24,7 +24,7 @@ public class SetDataPdu extends SimulationManagementFamilyPdu implements Seriali
    /** Number of fixed datum records */
    protected int  numberOfFixedDatumRecords;
 
-   /** Number of variable datum records */
+   /** Number of variable datum records, handled automatically by marshaller at run time (and not modifiable by end-user programmers) */
    protected int  numberOfVariableDatumRecords;
 
    /** variable length list of fixed datums */
diff --git a/src-generated/edu/nps/moves/dis7/UAEmitter.java b/src-generated/edu/nps/moves/dis7/UAEmitter.java
index 1c2b49efb2..d835976fff 100644
--- a/src-generated/edu/nps/moves/dis7/UAEmitter.java
+++ b/src-generated/edu/nps/moves/dis7/UAEmitter.java
@@ -22,6 +22,7 @@ public class UAEmitter extends Object implements Serializable
 
    protected short  padding;
 
+   /** TODO */
    protected AcousticEmitter  acousticEmitter = new AcousticEmitter(); 
 
    /** the location of the antenna beam source with respect to the emitting entity's coordinate system. This location shall be the origin of the emitter coordinate system that shall have the same orientation as the entity coordinate system. This field shall be represented by an Entity Coordinate Vector record see 6.2.95  */
diff --git a/src/edu/nps/moves/dis7/util/PduFactory.java b/src/edu/nps/moves/dis7/util/PduFactory.java
index 0ba3bf196b..9e6a69b94e 100644
--- a/src/edu/nps/moves/dis7/util/PduFactory.java
+++ b/src/edu/nps/moves/dis7/util/PduFactory.java
@@ -13,6 +13,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Stream;
 
 /**
  * PduFactory.java created on Jun 14, 2019
@@ -39,12 +40,18 @@ public class PduFactory
   private Method getTime;
   private boolean useFastPdu = false;
 
+  /**
+   * Create a PduFactory using defaults for country (USA), exerciseId (2), application (3) and absolute timestamps.
+   */
   public PduFactory()
   {
     this.disTime = new DisTime();
     getTimeStampMethod();
   }
-
+  
+  /**
+   * Create a PduFactory using the specified for country, exerciseId, application and  timestamp format.
+   */
   public PduFactory(Country country, byte exerciseId, short siteId, short applicationId, boolean useAbsoluteTimestamp)
   {
     this.disTime = new DisTime();
@@ -70,6 +77,10 @@ public class PduFactory
     }
   }
 
+  /**
+   * Use the default or fast method to create EntityState pdus from input byte streams.
+   * @param tf true if fast method
+   */
   public void useFastEspdu(boolean tf)
   {
     useFastPdu = tf;
@@ -193,7 +204,13 @@ public class PduFactory
   }
 
   /* ********************************** */
- /* Pdu construction methods */
+  /* Pdu construction methods */
+  
+  /**
+   * Create an Entity State PDU<br/>
+   * IEEE Std 1278.1-2012, 5.3.2
+   * @return pdu
+   */
   public EntityStatePdu makeEntityStatePdu()
   {
     EntityStatePdu pdu = new EntityStatePdu()
@@ -212,6 +229,11 @@ public class PduFactory
     return (EntityStatePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Fire PDU<br/>
+   * IEEE Std 1278.1-2012, 5.4.3
+   * @return pdu
+   */  
   public FirePdu makeFirePdu()
   {
     FirePdu pdu = new FirePdu()
@@ -226,6 +248,11 @@ public class PduFactory
     return (FirePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Detonation PDU<br/>
+   * IEEE Std 1278.1-2012, 5.4.4
+   * @return pdu
+   */  
   public DetonationPdu makeDetonationPdu()
   {
     DetonationPdu pdu = new DetonationPdu()
@@ -237,6 +264,11 @@ public class PduFactory
     return (DetonationPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Collision PDU<br/>
+   * IEEE Std 1278.1-2012, 5.3.3
+   * @return pdu
+   */  
   public CollisionPdu makeCollisionPdu()
   {
     CollisionPdu pdu = new CollisionPdu()
@@ -251,6 +283,11 @@ public class PduFactory
     return (CollisionPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Service Request PDU<br/>
+   * IEEE Std 1278.1-2012, 5.5.5
+   * @return pdu
+   */  
   public ServiceRequestPdu makeServiceRequestPdu()
   {
     ServiceRequestPdu pdu = new ServiceRequestPdu()
@@ -263,6 +300,11 @@ public class PduFactory
     return (ServiceRequestPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Resupply Offer PDU<br/>
+   * IEEE Std 1278.1-2012, 5.5.6
+   * @return pdu
+   */  
   public ResupplyOfferPdu makeResupplyOfferPdu()
   {
     ResupplyOfferPdu pdu = new ResupplyOfferPdu()
@@ -272,6 +314,11 @@ public class PduFactory
     return (ResupplyOfferPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Resupply Received PDU<br/>
+   * IEEE Std 1278.1-2012, 5.5.7
+   * @return pdu
+   */  
   public ResupplyReceivedPdu makeResupplyReceivedPdu()
   {
     ResupplyReceivedPdu pdu = new ResupplyReceivedPdu()
@@ -281,6 +328,11 @@ public class PduFactory
     return (ResupplyReceivedPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Resupply Cancel PDU<br/>
+   * IEEE Std 1278.1-2012, 5.5.8
+   * @return pdu
+   */  
   public ResupplyCancelPdu makeResupplyCancelPdu()
   {
     ResupplyCancelPdu pdu = new ResupplyCancelPdu()
@@ -290,6 +342,11 @@ public class PduFactory
     return (ResupplyCancelPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Repair Complete PDU<br/>
+   * IEEE Std 1278.1-2012, 5.5.10
+   * @return pdu
+   */  
   public RepairCompletePdu makeRepairCompletePdu()
   {
     RepairCompletePdu pdu = new RepairCompletePdu()
@@ -302,7 +359,12 @@ public class PduFactory
     return (RepairCompletePdu) addBoilerPlate(pdu);
   }
 
-  public RepairResponsePdu makeRepairResponsePdu()
+   /**
+   * Create a Repair Response PDU<br/>
+   * IEEE Std 1278.1-2012, 5.5.11
+   * @return pdu
+   */  
+ public RepairResponsePdu makeRepairResponsePdu()
   {
     RepairResponsePdu pdu = new RepairResponsePdu()
       .setReceivingEntityID(newEntityID())
@@ -314,6 +376,11 @@ public class PduFactory
     return (RepairResponsePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Create Entity PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.2
+   * @return pdu
+   */  
   public CreateEntityPdu makeCreateEntityPdu()
   {
     CreateEntityPdu pdu = new CreateEntityPdu();
@@ -321,7 +388,12 @@ public class PduFactory
     return (CreateEntityPdu) addBoilerPlate(pdu);
   }
 
-  public RemoveEntityPdu makeRemoveEntityPdu()
+   /**
+   * Create a Remove Entity PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.3
+   * @return pdu
+   */  
+ public RemoveEntityPdu makeRemoveEntityPdu()
   {
     RemoveEntityPdu pdu = new RemoveEntityPdu();
     pdu.setOriginatingID(newSimulationIdentifier());
@@ -330,6 +402,11 @@ public class PduFactory
     return (RemoveEntityPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Start Resume PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.4
+   * @return pdu
+   */  
   public StartResumePdu makeStartResumePdu()
   {
     StartResumePdu pdu = new StartResumePdu();
@@ -337,6 +414,11 @@ public class PduFactory
     return (StartResumePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Stop Freeze PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.5
+   * @return pdu
+   */  
   public StopFreezePdu makeStopFreezePdu()
   {
     StopFreezePdu pdu = new StopFreezePdu();
@@ -348,6 +430,11 @@ public class PduFactory
     return (StopFreezePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create an Acknowledge PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.6
+   * @return pdu
+   */  
   public AcknowledgePdu makeAcknowledgePdu()
   {
     AcknowledgePdu pdu = new AcknowledgePdu();
@@ -360,6 +447,11 @@ public class PduFactory
     return (AcknowledgePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create an Action Request PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.7
+   * @return pdu
+   */  
   public ActionRequestPdu makeActionRequestPdu()
   {
     ActionRequestPdu pdu = new ActionRequestPdu();
@@ -369,6 +461,11 @@ public class PduFactory
     return (ActionRequestPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create an Action Response PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.8
+   * @return pdu
+   */  
   public ActionResponsePdu makeActionResponsePdu()
   {
     ActionResponsePdu pdu = new ActionResponsePdu();
@@ -378,6 +475,11 @@ public class PduFactory
     return (ActionResponsePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Data Query PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.9
+   * @return pdu
+   */  
   public DataQueryPdu makeDataQueryPdu()
   {
     DataQueryPdu pdu = new DataQueryPdu();
@@ -385,6 +487,11 @@ public class PduFactory
     return (DataQueryPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Set DataPDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.10
+   * @return pdu
+   */  
   public SetDataPdu makeSetDataPdu()
   {
     SetDataPdu pdu = new SetDataPdu();
@@ -392,6 +499,11 @@ public class PduFactory
     return (SetDataPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Data PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.11
+   * @return pdu
+   */  
   public DataPdu makeDataPdu()
   {
     DataPdu pdu = new DataPdu();
@@ -399,6 +511,11 @@ public class PduFactory
     return (DataPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create an Event Report PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.12
+   * @return pdu
+   */  
   public EventReportPdu makeEventReportPdu()
   {
     EventReportPdu pdu = new EventReportPdu();
@@ -408,13 +525,53 @@ public class PduFactory
     return (EventReportPdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a Comment PDU<br/>
+   * IEEE Std 1278.1-2012, 5.6.5.13
+   * @return pdu
+   */  
   public CommentPdu makeCommentPdu()
   {
     CommentPdu pdu = new CommentPdu();
 
     return (CommentPdu) addBoilerPlate(pdu);
   }
+  
+  /**
+   * Create a Comment PDU containing the given String(s), variable record type = "OTHER"
+   * @param comments 
+   * @return the pdu
+   */
+  public CommentPdu makeCommentPdu(String ... comments)
+  {
+    return makeCommentPdu(VariableRecordType.OTHER, comments);
+  }
+  
+  /**
+   * Create a Comment PDU containing the given String(s) and variable record type
+   * @param typ VariableRecordType
+   * @param comments 
+   * @return the pdu
+   */
+  public CommentPdu makeCommentPdu(VariableRecordType typ, String... comments)
+  {
+    CommentPdu pdu = makeCommentPdu();
+    List<VariableDatum> list = pdu.getVariableDatums();
+    Stream.of(comments).forEach(s -> {
+      VariableDatum vardat = new VariableDatum();
+      vardat.setVariableDatumID(typ);
+      vardat.setVariableDatumValue(s.getBytes());
+      list.add(vardat);
+    });
 
+    return pdu;
+  }
+  
+  /**
+   * Create a Electromagnetic Emission (EE) PDU<br/>
+   * IEEE Std 1278.1-2012, 5.7.3
+   * @return pdu
+   */  
   public ElectromagneticEmissionPdu makeElectronicEmissionsPdu()
   {
     ElectromagneticEmissionPdu pdu = new ElectromagneticEmissionPdu()
@@ -895,6 +1052,37 @@ public class PduFactory
     return (CommentReliablePdu) addBoilerPlate(pdu);
   }
 
+  /**
+   * Create a CommentR PDU containing the given String(s), variable record type = "OTHER"
+   * @param comments 
+   * @return the pdu
+   */
+  public CommentReliablePdu makeCommentReliablePdu(String ... comments)
+  {
+    return makeCommentReliablePdu(VariableRecordType.OTHER, comments);
+  }
+  
+  /**
+   * Create a CommentR PDU containing the given String(s) and variable record type
+   * @param typ VariableRecordType
+   * @param comments 
+   * @return the pdu
+   */
+  public CommentReliablePdu makeCommentReliablePdu(VariableRecordType typ, String... comments)
+  {
+    CommentReliablePdu pdu = makeCommentReliablePdu();
+    List<VariableDatum> list = pdu.getVariableDatumRecords();
+    Stream.of(comments).forEach(s -> {
+      VariableDatum vardat = new VariableDatum();
+      vardat.setVariableDatumID(typ);
+      vardat.setVariableDatumValue(s.getBytes());
+      list.add(vardat);
+    });
+
+    return pdu;
+  }
+  
+  
   public RecordReliablePdu makeRecordReliablePdu()
   {
     RecordReliablePdu pdu = new RecordReliablePdu();
diff --git a/test/edu/nps/moves/dis7/CommentPdusTest.java b/test/edu/nps/moves/dis7/CommentPdusTest.java
new file mode 100644
index 0000000000..061aed5542
--- /dev/null
+++ b/test/edu/nps/moves/dis7/CommentPdusTest.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright (c) 2008-2019, MOVES Institute, Naval Postgraduate School. All rights reserved.
+ * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html
+ */
+package edu.nps.moves.dis7;
+
+import edu.nps.moves.dis7.enumerations.VariableRecordType;
+import edu.nps.moves.dis7.util.DisNetworking;
+import edu.nps.moves.dis7.util.PduFactory;
+import java.io.IOException;
+import org.junit.jupiter.api.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+@DisplayName("Comment Pdus Test")
+public class CommentPdusTest
+{
+  @BeforeAll
+  public static void setUpClass()
+  {
+    System.out.println("CommentPdusTest");
+  }
+
+  @AfterAll
+  public static void tearDownClass()
+  {
+  }
+
+  @BeforeEach
+  public void setUp()
+  {
+  }
+
+  @AfterEach
+  public void tearDown()
+  {
+  }
+
+  private Pdu receivedPdu;
+
+  @Test
+  public void testRoundTrip()
+  {
+    PduFactory factory = new PduFactory();
+    setUpReceiver();
+    
+    testOne(factory.makeCommentPdu());
+    testOne(factory.makeCommentPdu("123_test_string"));
+    testOne(factory.makeCommentPdu(VariableRecordType.MODEL_TYPE, "456_test with type = modeltype"));
+    testOne(factory.makeCommentPdu("xyz first message","mno second message", "jkl third message"));
+    
+    testOne(factory.makeCommentReliablePdu());
+    testOne(factory.makeCommentReliablePdu("789_test_string"));
+    testOne(factory.makeCommentReliablePdu(VariableRecordType.ACLS_AIRCRAFT_REPORT, "abc_test with type = acls_aircraft_report"));
+    testOne(factory.makeCommentReliablePdu("xyz R first message","mno R second message", "jkl R third message"));   
+  }
+  
+  private void testOne(Pdu pdu)
+  {
+     sendPdu(pdu); // will wait a while
+     assertTrue(receivedPdu != null, "No response from network receive");
+     assertTrue(compare(pdu,receivedPdu),"Comparison failed");
+     receivedPdu = null;
+  }
+  
+  private void sendPdu(Pdu pdu)
+  {
+    try {
+      Thread.sleep(250l); // make sure receiver is listening
+      DisNetworking disnet = new DisNetworking();
+      disnet.sendPdu(pdu);
+
+      Thread.sleep(1000l);
+    }
+    catch (Exception ex) {
+      System.err.println("Error sending Multicast: " + ex.getLocalizedMessage());
+      System.exit(1);
+    }
+  }
+ 
+  private boolean compare(Pdu pdu1, Pdu pdu2)
+  {
+    return pdu1.equals(pdu2);
+  }
+  
+  private void setUpReceiver()
+  {
+    Thread rcvThread = new Thread(() -> {
+      try {
+        while(true) {
+          receivedPdu = new DisNetworking().receivePdu();  // blocks
+        }
+      }
+      catch (IOException ex) {
+        System.err.println("Error receiving Multicast: " + ex.getLocalizedMessage());
+        System.exit(1);
+      }
+    });
+
+    rcvThread.setPriority(Thread.NORM_PRIORITY);
+    rcvThread.setDaemon(true);
+    rcvThread.start();
+  }
+
+  public static void main(String[] args)
+  {
+    new CommentPdusTest().testRoundTrip();
+  }
+}
-- 
GitLab