Back
ExamFull examExam paper only

20230710

Full exam for Ingegneria del Software in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Ingegneria del Software — Soluzione del Tema 10/07/2023 Esercizio 1 Si consideri la seguente classe immutabile Message. Ogni messaggio ha un contenuto, un mittente, un destinatario e un timestamp. Mittente e destinatario sono individuati univocamente da un identificatore, per

Ingegneria del SoftwareFull exam

Document information

What's included in this study material

Full exam for Ingegneria del Software in the Computer Engineering degree programme at Politecnico di Milano. The document covers: Ingegneria del Software — Soluzione del Tema 10/07/2023 Esercizio 1 Si consideri la seguente classe immutabile Message. Ogni messaggio ha un contenuto, un mittente, un destinatario e un timestamp. Mittente e destinatario sono individuati univocamente da un identificatore, per

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 1

Ingegneria del Software — Soluzione del Tema 10/07/2023 Esercizio 1 Si consideri la seguente classe immutabile Message. Ogni messaggio ha un contenuto, un mittente, un destinatario e un timestamp. Mittente e destinatario sono individuati univocamente da un identificatore, per semplicit `a un long. Ancora per semplicit`a, il timestamp `e un long (anzich´e un Date). public /*@ pure @ */ class Message { public Message(byte[] content, long recipientID, long senderID, long timestamp) {...} public byte [] content() {...} // returns the content of this public long recipientID() {...} // returns the recipientID of this public long senderID() {...} // returns the senderID of this public long timestamp() {...} // returns the timestamp of this } La seguente classe MessageManager descrive un gestore di messaggi. `E possibile inviare ed estrarre messaggi, vedere elenchi dei messaggi e degli utenti; in particolare, `e possibile fondere un altro gestore messaggi con quello corrente. public class MessageManager { // Builds a new empty manager public MessageManager() {...} // Returns the set of all valid ids, i.e., ids of recipients or senders of some message in the past. public /*@ pure @ */ Set<Long> allIds() {...} // Returns all messages yet to be delivered to the recipient having the given recipientId, // from the oldest to the newest. // Returns an empty list if the recipient is unknown or if there is no message to be delivered it. public /*@ pure @ */ List<Message> toId( long recipientId) {...} // Returns all messages, yet to be delivered, sent from the sender having the given senderId. // Throws an UnknownIdException if the sender is unknown. public /*@ pure @ */ Set<Message> fromId( long senderId) throws UnknownIdException {...} // Inserts a new message in the manager, with the…

Preview

First page of the document.

First page: 20230710