diff --git a/main/src/main/java/sd/protocol/MessageProtocol.java b/main/src/main/java/sd/protocol/MessageProtocol.java index 9f20437..47975be 100644 --- a/main/src/main/java/sd/protocol/MessageProtocol.java +++ b/main/src/main/java/sd/protocol/MessageProtocol.java @@ -1,44 +1,41 @@ package sd.protocol; - - import java.io.Serializable; - -import sd.model.MessageType; +import sd.model.MessageType; // Assuming MessageType is in sd.model or sd.protocol /** - * Interface que define o contrato para todas as mensagens trocadas no simulador. - * Garante que qualquer mensagem possa ser identificada e roteada. - * * Esta interface estende Serializable para permitir que os objetos que a implementam - * sejam enviados através de Sockets (ObjectOutputStream). + * Interface defining the contract for all messages exchanged in the simulator. + * Ensures that any message can be identified and routed. + * * This interface extends Serializable to allow objects that implement it + * to be sent over Sockets (ObjectOutputStream). * */ public interface MessageProtocol extends Serializable { /** - * Retorna o tipo da mensagem, indicando o seu propósito. - * @return O MessageType (ex: VEHICLE_TRANSFER, STATS_UPDATE). + * Returns the type of the message, indicating its purpose. + * @return The MessageType (e.g., VEHICLE_TRANSFER, STATS_UPDATE). */ MessageType getType(); /** - * Retorna o objeto de dados (carga útil) que esta mensagem transporta. - * O tipo de objeto dependerá do MessageType. - * * - Se getType() == VEHICLE_TRANSFER, o payload será um objeto {@link sd.model.Vehicle}. - * - Se getType() == STATS_UPDATE, o payload será um objeto de estatísticas. - * * @return O objeto de dados (payload), que também deve ser Serializable. + * Returns the data object (payload) that this message carries. + * The type of object will depend on the MessageType. + * * - If getType() == VEHICLE_TRANSFER, the payload will be a {@link sd.model.Vehicle} object. + * - If getType() == STATS_UPDATE, the payload will be a statistics object. + * * @return The data object (payload), which must also be Serializable. */ Object getPayload(); /** - * Retorna o ID do nó (Processo) que enviou esta mensagem. - * @return String (ex: "Cr1", "Cr5", "S"). + * Returns the ID of the node (Process) that sent this message. + * @return String (e.g., "Cr1", "Cr5", "S"). */ String getSourceNode(); /** - * Retorna o ID do nó (Processo) de destino desta mensagem. - * @return String (ex: "Cr2", "DashboardServer"). + * Returns the ID of the destination node (Process) for this message. + * @return String (e.g., "Cr2", "DashboardServer"). */ String getDestinationNode(); -} +} \ No newline at end of file diff --git a/main/src/main/java/sd/protocol/SocketConnection.java b/main/src/main/java/sd/protocol/SocketConnection.java new file mode 100644 index 0000000..d56ad9c --- /dev/null +++ b/main/src/main/java/sd/protocol/SocketConnection.java @@ -0,0 +1,5 @@ +package sd.protocol; + +public class SocketConnection { + +}