Package com.inesm.KeyManager.model
Class Receipt
java.lang.Object
com.inesm.KeyManager.model.Receipt
- All Implemented Interfaces:
NetworkResource,Resource,Serializable
Represents an acknowledgment of the reception of a message.
All the getters and setters are the default ones.
Details about the meaning of each field are provided in the source code.
- See Also:
-
Field Summary
Fields inherited from interface com.inesm.KeyManager.model.NetworkResource
DIRECT_MODE, HIERARCHICAL_MODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(String data) Deserializes the resource from a data string generated by theResource.serialize()method.Gets the destination of the network resource.longintgetMode()Gets the distribution mode of the network resource.Gets the nextHop of the network resource.longGets the station resource identifier.intgetTime()booleanbooleanChecks if the network resource is aMessage.booleanChecks if network resource is aReceipt.Serializes a resource into a string.voidsetDestination(String destination) voidsetMessageID(long messageID) voidsetMode(int mode) voidsetNextHop(String nextHop) voidsetReceiptID(long receiptID) voidsetSignature(String signature) voidvoidsetStatus(int status) voidsetTime(LocalDateTime time) voidsetWaiting(boolean waiting) toString()
-
Constructor Details
-
Receipt
public Receipt(long messageID, String source, String destination, LocalDateTime time, int mode, boolean waiting) -
Receipt
-
Receipt
public Receipt()
-
-
Method Details
-
toString
-
isMessage
public boolean isMessage()Description copied from interface:NetworkResourceChecks if the network resource is aMessage.- Specified by:
isMessagein interfaceNetworkResource- Returns:
- true if it is, false otherwise
-
isReceipt
public boolean isReceipt()Description copied from interface:NetworkResourceChecks if network resource is aReceipt.- Specified by:
isReceiptin interfaceNetworkResource- Returns:
- true if it is, false otherwise
-
serialize
Description copied from interface:ResourceSerializes a resource into a string.- Specified by:
serializein interfaceResource- Returns:
- the string representing the serialization of the resource.
- Throws:
IOException- if an error occurred during serialization
-
deserialize
Description copied from interface:ResourceDeserializes the resource from a data string generated by theResource.serialize()method.- Specified by:
deserializein interfaceResource- Parameters:
data- the serialized data as a string- Throws:
IOException- if an error occurred during the serialization processClassNotFoundException- if its was not possible to load the class data, or the class data was not found
-
getResourceID
Description copied from interface:ResourceGets the station resource identifier.- Specified by:
getResourceIDin interfaceResource- Returns:
- a string containing the resource identifier.
-
getReceiptID
public long getReceiptID() -
setReceiptID
public void setReceiptID(long receiptID) -
getMessageID
public long getMessageID() -
setMessageID
public void setMessageID(long messageID) -
getDestination
Description copied from interface:NetworkResourceGets the destination of the network resource.- Specified by:
getDestinationin interfaceNetworkResource- Returns:
- the path of the destination station
-
setDestination
-
getSource
-
setSource
-
getTime
-
setTime
-
getStatus
public int getStatus() -
setStatus
public void setStatus(int status) -
getMode
public int getMode()Description copied from interface:NetworkResourceGets the distribution mode of the network resource.- Specified by:
getModein interfaceNetworkResource- Returns:
- the distribution mode flag between
NetworkResource.DIRECT_MODEandNetworkResource.HIERARCHICAL_MODE.
-
setMode
public void setMode(int mode) -
getSignature
-
setSignature
-
getNextHop
Description copied from interface:NetworkResourceGets the nextHop of the network resource.- Specified by:
getNextHopin interfaceNetworkResource- Returns:
- the path of the next-hop station
-
setNextHop
-
getWaiting
public boolean getWaiting() -
setWaiting
public void setWaiting(boolean waiting)
-