Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules
This commit is contained in:
@@ -37,6 +37,10 @@ public class VisualiserInput implements Runnable
|
||||
|
||||
private Map<Integer, BoatLocationMessage> boatLocation;
|
||||
|
||||
private RaceStatus raceStatus;
|
||||
|
||||
private Map<Integer, BoatStatusMessage> boatStatus;
|
||||
|
||||
public VisualiserInput(StreamedCourse course) throws IOException{
|
||||
|
||||
this.connectionSocket = new Socket(InetAddress.getLocalHost(), 4945);
|
||||
@@ -44,6 +48,7 @@ public class VisualiserInput implements Runnable
|
||||
|
||||
this.course = course;
|
||||
this.boatLocation = new HashMap<>();
|
||||
this.boatStatus = new HashMap<>();
|
||||
|
||||
|
||||
//start Time
|
||||
@@ -77,6 +82,30 @@ public class VisualiserInput implements Runnable
|
||||
return (now - lastHeartbeatTime) / 1000.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boat locations
|
||||
* @return locations of where the boats are
|
||||
*/
|
||||
public Map<Integer, BoatLocationMessage> getBoatLocation() {
|
||||
return boatLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status of the race
|
||||
* @return the status of the race
|
||||
*/
|
||||
public RaceStatus getRaceStatus() {
|
||||
return raceStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hashmap of the boat status'
|
||||
* @return Hash map of boat status
|
||||
*/
|
||||
public Map<Integer, BoatStatusMessage> getBoatStatus() {
|
||||
return boatStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an inputStream and reads the first 15 bytes (the header) and gets the message length
|
||||
* for the whole message then reads that and returns the byte array
|
||||
@@ -129,6 +158,10 @@ public class VisualiserInput implements Runnable
|
||||
break;
|
||||
case RACESTATUS:
|
||||
System.out.println("Race Status Message");
|
||||
raceStatus = ((RaceStatus) data);
|
||||
for (BoatStatusMessage msg: raceStatus.getBoatStatusMessages()){
|
||||
boatStatus.put(msg.getSourceID(), msg);
|
||||
}
|
||||
break;
|
||||
case DISPLAYTEXTMESSAGE:
|
||||
// System.out.println("Display Text Message");
|
||||
|
||||
Reference in New Issue
Block a user