Skip to content

Commit

Permalink
Added Javadoc comments for InfrastructureMessageAmbassador
Browse files Browse the repository at this point in the history
Update log statements to not using string concatenation.
  • Loading branch information
paulbourelly999 committed Aug 1, 2023
1 parent 8fb2676 commit b444173
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ public void onTimeStepUpdate(InfrastructureTimeMessage message) throws IOExcepti
public boolean checkIfRegistered(String infrastructureId) {
return managedInstances.keySet().contains(infrastructureId);
}

/**
* Returns Map of managed infrastructure instances with infrastructure ID as the
* String Key.
*
* @return map of managed infrastructure instances.
*/
public Map<String, InfrastructureInstance> getManagedInstances() {
return managedInstances;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ public void processInteraction(Interaction interaction) throws InternalFederateE
}
}


/**
* Provide infrastructure instance manager with detected objects from processed detected
* object interactions.
*
* @param interaction processed detected objected interaction.
*/
private synchronized void receiveDetectedObjectInteraction( DetectedObjectInteraction interaction) {
log.trace("Process Detected Object Interaction {}", interaction);
infrastructureInstanceManager.onDetectedObject(interaction.getDetectedObject());
Expand Down Expand Up @@ -283,7 +288,7 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder
if (time < currentSimulationTime) {
return;
}
log.info("Infrastructure message ambassador processing timestep to " + time);
log.info("Infrastructure message ambassador processing timestep to {}.", time);
try {

// Handle any new infrastructure registration requests
Expand All @@ -310,7 +315,7 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder
} else {
List<Tuple<InetAddress, CarmaV2xMessage>> newMessages = v2xMessageReceiver.getReceivedMessages();
for (Tuple<InetAddress, CarmaV2xMessage> msg : newMessages) {
log.info("Processing new V2X transmit event of type " + msg.getB().getType());
log.info("Processing new V2X transmit event of type {}.", msg.getB().getType());
V2xMessageTransmission msgInt = infrastructureInstanceManager.onV2XMessageTx(msg.getA(), msg.getB(), currentSimulationTime);
SimulationKernel.SimulationKernel.getV2xMessageCache().putItem(currentSimulationTime, msgInt.getMessage());
log.info("Inserted message ID {} into v2xmessage cache.", msgInt.getMessageId());
Expand All @@ -331,13 +336,12 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder
currentSimulationTime += infrastructureConfiguration.updateInterval * TIME.MILLI_SECOND;

// Request the next time advance from the RTI
log.info("Requesting timestep updated to " + currentSimulationTime);
log.info("Requesting timestep updated to {}.", currentSimulationTime);
rti.requestAdvanceTime(currentSimulationTime, 0, (byte) 2);
} catch (IllegalValueException e) {
log.error("Error during advanceTime(" + time + ")", e);
throw new InternalFederateException(e);
} catch (IOException e1) {
log.error("Error during updating timestep :" + e1.getMessage());
log.error("Error during updating timestep :", e1);
}
}

Expand Down

0 comments on commit b444173

Please sign in to comment.