From b55226243aa982519c81b20c78968f1a82149fc0 Mon Sep 17 00:00:00 2001
From: cs2017 <cs2017@DESKTOP-C0KH063.ern.nps.edu>
Date: Thu, 8 Mar 2018 17:38:21 -0800
Subject: [PATCH] Cleanup

---
 .../AngelBlankEspduReceiverAtoTCP.java        | 15 -----
 .../AngelBlankEspduReceiverBtoTCP.java        | 18 +-----
 .../AngelBlankEspduTCPReceiverASenderB.java   | 56 +++----------------
 .../AngelBlankEspduTCPReceiverBSenderA.java   | 48 ++--------------
 4 files changed, 16 insertions(+), 121 deletions(-)

diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverAtoTCP.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverAtoTCP.java
index 95c27976ee..113dbe0c7c 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverAtoTCP.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverAtoTCP.java
@@ -6,8 +6,6 @@ import edu.nps.moves.disutil.*;
 import edu.nps.moves.dis.*;
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
 
 /**
  * Receives PDUs from the network creates a TCP connection, then 
@@ -74,21 +72,8 @@ public class AngelBlankEspduReceiverAtoTCP {
                                 
                                 DatagramPacket DpSend =  new DatagramPacket(data, data.length,  InetAddress.getByName(TCP_DESTINATION_IP), TCP_DESTINATION_PORT);
                                 dataGram.send(DpSend);
-                                //Socket clientConnection = new Socket(TCP_DESTINATION_IP, TCP_DESTINATION_PORT); 
-                                //OutputStream os = clientConnection.getOutputStream();
-                                //PrintStream ps = new PrintStream(os);
                                 System.out.println("Alpha Bridging Complete to: " + TCP_DESTINATION_IP);
                                 //EntityType entityType = ((EntityStatePdu)aPdu).getEntityType();
-                                /**ps.println(eid.getSite());
-                                ps.println(eid.getApplication());
-                                ps.println(eid.getEntity());
-                                ps.println(entityType.getEntityKind());      // Platform (vs lifeform, munition, sensor, etc.)
-                                ps.println(entityType.getCountry());              // USA
-                                ps.println(entityType.getDomain());          // Land (vs air, surface, subsurface, space)
-                                ps.println(entityType.getCategory());        // Tank
-                                ps.println(entityType.getSubcategory());     // M1 Abrams
-                                ps.println(entityType.getSpec());            // M1A2 Abrams**/
- 
                             }
                             Vector3Double location = ((EntityStatePdu)aPdu).getEntityLocation();
                             System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] ");
diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverBtoTCP.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverBtoTCP.java
index 1dee2574ed..eddb89e2ff 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverBtoTCP.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduReceiverBtoTCP.java
@@ -6,8 +6,7 @@ import edu.nps.moves.disutil.*;
 import edu.nps.moves.dis.*;
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
+
 
 /**
  * Receives PDUs from the network in IEEE format and creates a TCP connection, 
@@ -63,23 +62,8 @@ public class AngelBlankEspduReceiverBtoTCP {
                                 
                             DatagramPacket DpSend =  new DatagramPacket(data, data.length,  InetAddress.getByName(TCP_DESTINATION_IP), TCP_DESTINATION_PORT);
                             dataGram.send(DpSend);                                    // Create TCP Bridge
-                           //Socket clientConnection = new Socket(TCP_DESTINATION_IP, TCP_DESTINATION_PORT); 
-                           // OutputStream os = clientConnection.getOutputStream();
-                            //PrintStream ps = new PrintStream(os);
-
                             System.out.println("Bravo briding complete to: "+ TCP_DESTINATION_IP);
                             //EntityType entityType = ((EntityStatePdu)aPdu).getEntityType();
-                           /** ps.println(eid.getSite());
-                            ps.println(eid.getApplication());
-                            ps.println(eid.getEntity());
-                            ps.println(entityType.getEntityKind());      // Platform (vs lifeform, munition, sensor, etc.)
-                            ps.println(entityType.getCountry());              // USA
-                            ps.println(entityType.getDomain());          // Land (vs air, surface, subsurface, space)
-                            ps.println(entityType.getCategory());        // Tank
-                            ps.println(entityType.getSubcategory());     // M1 Abrams
-                            ps.println(entityType.getSpec());            // M1A2 Abrams**/
-
-                          
                             }
                             Vector3Double location = ((EntityStatePdu)aPdu).getEntityLocation();
                             System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] ");
diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverASenderB.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverASenderB.java
index 834149b75e..69fe835002 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverASenderB.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverASenderB.java
@@ -104,7 +104,6 @@ public static void main(String args[])
     {
         int connectionCount = 0;
         DatagramSocket ds = new DatagramSocket(TCP_DESTINATION_PORT);
-        //ServerSocket serverSocket = new ServerSocket(TCP_DESTINATION_PORT);
 
         while(true){
             try
@@ -112,7 +111,6 @@ public static void main(String args[])
                 byte buffer[] = new byte[MAX_PDU_SIZE];
                 DatagramPacket tcpPacket = new DatagramPacket(buffer, buffer.length);
                 ds.receive(tcpPacket);
-                //Socket clientConnection = serverSocket.accept();
                 connectionCount++;
                 System.out.println("Current PDUs transferred over TCP: "+ connectionCount);
                 List<Pdu> pduBundle = pduFactory.getPdusFromBundle(tcpPacket.getData());
@@ -126,50 +124,14 @@ public static void main(String args[])
                     if(aPdu instanceof EntityStatePdu){
                         EntityID eid = ((EntityStatePdu)aPdu).getEntityID();
                         System.out.println("Entity ID transferred: "+eid.getEntity());
-                        
-                        //System.out.println();
-                     // end trop through PDU bundle
-                //System.out.println("RA SB received TCP connection.");
-                /**InputStream is = clientConnection.getInputStream();
-                InputStreamReader isr = new InputStreamReader(is);
-                BufferedReader br = new BufferedReader(isr);
-                //System.out.println("RA SB waiting to readline.");
-                int entitySite = Integer.parseInt(br.readLine());
-                int entityApplication = Integer.parseInt(br.readLine());
-                int entityEntity = Integer.parseInt(br.readLine());
-                short entityEntityKind = Short.parseShort(br.readLine());
-                int entityCountry = Integer.parseInt(br.readLine());
-                short entityDomain = Short.parseShort(br.readLine());
-                short entityCategory = Short.parseShort(br.readLine());
-                short entitySubcategory = Short.parseShort(br.readLine());
-                short entitySpec = Short.parseShort(br.readLine());
-                //System.out.println("RA SB reading complete.");               
-                espdu.setExerciseID((short)1);
-                EntityID eid = espdu.getEntityID();
-                eid.setSite(entitySite);  // 0 is apparently not a valid site number, per the spec
-                eid.setApplication(entityApplication); 
-                eid.setEntity(entityEntity);
-                EntityType entityType = espdu.getEntityType();
-                entityType.setEntityKind(entityEntityKind);      // Platform (vs lifeform, munition, sensor, etc.)
-                entityType.setCountry(entityCountry);              // USA
-                entityType.setDomain(entityDomain);          // AIR (vs air, surface, subsurface, space)
-                entityType.setCategory(entityCategory);        // Tank
-                entityType.setSubcategory(entitySubcategory);     // M1 Abrams
-                entityType.setSpec(entitySpec);            // M1A2 Abrams  **/            
-                //int ts = disTime.getDisAbsoluteTimestamp();
-                //espdu.setTimestamp(ts);
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                DataOutputStream dos = new DataOutputStream(baos);
-                aPdu.marshal(dos);
-                // The byte array here is the packet in DIS format. We put that into a 
-                // datagram and send it.
-                byte[] data = baos.toByteArray();
-                DatagramPacket udpPacket = new DatagramPacket(data, data.length, InetAddress.getByName(DEFAULT_MULTICAST_GROUP), DIS_DESTINATION_PORT);
-                socket.send(udpPacket); 
+                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                        DataOutputStream dos = new DataOutputStream(baos);
+                        aPdu.marshal(dos);
+                        byte[] data = baos.toByteArray();
+                        DatagramPacket udpPacket = new DatagramPacket(data, data.length, InetAddress.getByName(DEFAULT_MULTICAST_GROUP), DIS_DESTINATION_PORT);
+                        socket.send(udpPacket); 
                     }
-                //System.out.println(" EID=[" + eid.getSite() + "," + eid.getApplication() + "," + eid.getEntity() + "]");
-                //clientConnection.close();
-            }
+                }
             }
             catch(Exception e)
             {
@@ -184,7 +146,7 @@ public static void main(String args[])
         
 }
 
-
+/**
    public static Set<InetAddress> getBroadcastAddresses()
    {
        Set<InetAddress> bcastAddresses = new HashSet<InetAddress>();
@@ -224,5 +186,5 @@ public static void main(String args[])
        
        return bcastAddresses;   
    }
-
+**/
 }
diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverBSenderA.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverBSenderA.java
index cf14cd688c..582ea180c6 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverBSenderA.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduTCPReceiverBSenderA.java
@@ -106,7 +106,6 @@ public static void main(String args[])
     {
         int connectionCount = 0;
         DatagramSocket ds = new DatagramSocket(TCP_DESTINATION_PORT);
-        //ServerSocket serverSocket = new ServerSocket(TCP_DESTINATION_PORT);
 
         while(true){
             try
@@ -128,48 +127,13 @@ public static void main(String args[])
                     if(aPdu instanceof EntityStatePdu){
                         EntityID eid = ((EntityStatePdu)aPdu).getEntityID();
                         System.out.println("Entity ID transferred: "+eid.getEntity());
-
-                /**
-                //System.out.println("RB SA received TCP connection.");
-                InputStream is = clientConnection.getInputStream();
-                InputStreamReader isr = new InputStreamReader(is);
-                BufferedReader br = new BufferedReader(isr);
-                //System.out.println("RB SA waiting to readline.");
-                int entitySite = Integer.parseInt(br.readLine());
-                int entityApplication = Integer.parseInt(br.readLine());
-                int entityEntity = Integer.parseInt(br.readLine());
-                short entityEntityKind = Short.parseShort(br.readLine());
-                int entityCountry = Integer.parseInt(br.readLine());
-                short entityDomain = Short.parseShort(br.readLine());
-                short entityCategory = Short.parseShort(br.readLine());
-                short entitySubcategory = Short.parseShort(br.readLine());
-                short entitySpec = Short.parseShort(br.readLine());
-                //System.out.println("RB SA reading complete.");
-                espdu.setExerciseID((short)1);
-                EntityID eid = espdu.getEntityID();
-                eid.setSite(entitySite);  // 0 is apparently not a valid site number, per the spec
-                eid.setApplication(entityApplication); 
-                eid.setEntity(entityEntity);
-                EntityType entityType = espdu.getEntityType();
-                entityType.setEntityKind(entityEntityKind);      // Platform (vs lifeform, munition, sensor, etc.)
-                entityType.setCountry(entityCountry);              // USA
-                entityType.setDomain(entityDomain);          // AIR (vs air, surface, subsurface, space)
-                entityType.setCategory(entityCategory);        // Tank
-                entityType.setSubcategory(entitySubcategory);     // M1 Abrams
-                entityType.setSpec(entitySpec);            // M1A2 Abrams
-                int ts = disTime.getDisAbsoluteTimestamp();
-                espdu.setTimestamp(ts);**/
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                DataOutputStream dos = new DataOutputStream(baos);
-                aPdu.marshal(dos);
-
-                // The byte array here is the packet in DIS format. We put that into a 
-                // datagram and send it.
-                byte[] data = baos.toByteArray();
-                DatagramPacket udpPacket = new DatagramPacket(data, data.length, InetAddress.getByName(DEFAULT_MULTICAST_GROUP), DIS_DESTINATION_PORT);
-                socket.send(udpPacket); 
+                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                        DataOutputStream dos = new DataOutputStream(baos);
+                        aPdu.marshal(dos);
+                        byte[] data = baos.toByteArray();
+                        DatagramPacket udpPacket = new DatagramPacket(data, data.length, InetAddress.getByName(DEFAULT_MULTICAST_GROUP), DIS_DESTINATION_PORT);
+                        socket.send(udpPacket); 
                     }       
-                //System.out.println(" EID=[" + eid.getSite() + "," + eid.getApplication() + "," + eid.getEntity() + "]");
                 }
             }
             catch(Exception e)
-- 
GitLab