diff --git a/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv b/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv index f745cb6c951c8f45efa23edf9741aa0c85e6613b..46c0f4bee49014a5326f921539ce589ef37372e0 100644 --- a/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv +++ b/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv @@ -1,17 +1,18 @@ -1,1,66,1,225,1,1,1,2,36.595517,-121.877000 -1,1,65,1,225,1,1,1,2,36.595701,-121.876903 -1,1,11,1,225,1,1,1,2,36.595600,-121.876800 -1,1,12,1,225,1,1,1,4,36.595602,-121.876802 -1,1,13,1,225,1,1,1,5,36.595598,-121.876800 -1,1,14,1,225,1,1,1,2,36.595596,-121.876802 -1,1,21,1,225,1,1,1,2,36.595000,-121.876900 -1,1,22,1,225,1,1,1,4,36.595002,-121.876902 -1,1,23,1,225,1,1,1,5,36.594998,-121.876900 -1,1,24,1,225,1,1,1,2,36.594996,-121.876902 -1,1,31,1,225,1,1,1,2,36.595700,-121.876900 -1,1,32,1,225,1,1,1,4,36.595702,-121.876902 -1,1,33,1,225,1,1,1,5,36.595698,-121.876900 -1,1,34,1,225,1,1,1,2,36.595696,-121.876902 -1,1,07,1,225,1,6,1,1,36.595600,-121.877010 -1,1,04,1,225,1,7,12,1,36.595601,-121.877012 -1,1,77,1,225,1,3,14,0,36.595599,-121.877011 +#exerciseID,#siteID,#entityID,#entityKind,#Country,#Domain,#Category,#Subcategory,#special,#lat,#long +1,1,66,1,225,1,1,1,2,36.5955,-121.875 +1,1,65,1,225,1,1,1,2,36.588,-121.882 +1,1,11,1,225,1,1,1,2,36.596,-121.877 +1,1,12,1,225,1,1,1,4,36.597,-121.878 +1,1,13,1,225,1,1,1,5,36.594,-121.878 +1,1,14,1,225,1,1,1,2,36.595,-121.877 +1,1,21,1,225,1,1,1,2,36.603,-121.88 +1,1,22,1,225,1,1,1,4,36.604,-121.881 +1,1,23,1,225,1,1,1,5,36.601,-121.881 +1,1,24,1,225,1,1,1,2,36.602,-121.88 +1,1,31,1,225,1,1,1,2,36.588,-121.88 +1,1,32,1,225,1,1,1,4,36.589,-121.881 +1,1,33,1,225,1,1,1,5,36.586,-121.881 +1,1,34,1,225,1,1,1,2,36.587,-121.88 +1,1,7,1,225,1,6,1,1,36.5956,-121.87701 +1,1,4,1,225,1,7,12,1,36.596,-121.878 +1,1,77,1,225,1,3,14,,36.595,-121.879 diff --git a/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java b/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java index f17a574b1558806575e5fc36dcfcaf599a886618..95365930a5f5829051bb8579368fb47add033088 100644 --- a/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java +++ b/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java @@ -171,11 +171,19 @@ public static void main(String args[]) throws FileNotFoundException for (int idx =0; idx<10; idx++){ scanner = new Scanner(inputFile); //this scanner reads from the .csv file identified by fileName + + //this next line is only necesary if the .csv has a header row. this has the + //scanner read the line and gets ready for the parsing in the while loop. + //if the .csv does not have a header, comment out this line or you will miss the first entity. + scanner.nextLine(); + + //this section reads through the .csv and parses it to send out as an espdu. while(scanner.hasNextLine()) { String line = scanner.nextLine(); //System.out.println(line); String[] splits; splits = line.split(","); + if (splits[0].startsWith("#")) continue; //this section parse each line into the component necessary to build a DIS ESPDU; int kind = Integer.parseInt(splits[3]); int country = Integer.parseInt(splits[4]); @@ -189,7 +197,7 @@ public static void main(String args[]) throws FileNotFoundException float entityLon = Float.parseFloat(splits[10]); //System.out.println(entityLon); - //Thi section provides the ESPDU its entity specific information + //This section provides the ESPDU its entity specific information entityID.setEntity(bumperNumber); EntityType entityType = espdu.getEntityType(); entityType.setEntityKind((short) kind); // Platform (vs lifeform, munition, sensor, etc.)