void function ( MessageContents arg0 , CommUser arg1 ) { checkRegistered ( ) ; checkArgument ( user != arg1 , "srini_string" , arg1 ) ; checkArgument ( model . contains ( arg1 ) , "srini_string" , user , arg1 ) ; outbox . add ( Message . createDirect ( user , arg1 , arg0 , rangePredicate ) ) ; }
attempts to send a message with the specified contents to the specified recipient . the actual sending of a message is done at the end of the current tick . based on the reliability , range and position it is determined whether the message will be sent . until a message is sent it lives in the #getoutbox of the device . reliability if this device has a reliability of p there is a probability of 1-p that the message will not be sent . if the receiving device has a reliability of r there is a probability of 1-r that the message will not be received at the other end . this means that in practice the probability of a successful delivery is 1-p 1-r . range if this device has a maximum range the message will only be delivered if the recipient is within that range at the moment of sending at the end of the tick . note that the range only influences sending of messages , it is possible to receive messages from senders that are outside of its max range . position if the commuser that owns this device has noposition commuser #getposition is absent and this devicehas a maximum range #getmaxrange is present . the message willnot be sent and will stay in the outbox of this device see #getoutbox . if at a later stage the commuser gets aposition all messages that are still in the outbox will be sent . the outbox can be cleared by calling #clearoutbox . concode_field_sep List<Message> unreadMessages concode_elem_sep double reliability concode_elem_sep boolean registered concode_elem_sep double range concode_elem_sep CommModel model concode_elem_sep Optional<Double> maxRange concode_elem_sep int receivedCount concode_elem_sep CommUser user concode_elem_sep List<Message> outbox concode_elem_sep Predicate<CommUser> rangePredicate concode_field_sep void broadcast concode_elem_sep void receive concode_elem_sep Optional<Double> getMaxRange concode_elem_sep boolean apply concode_elem_sep void checkRegistered concode_elem_sep ImmutableList<Message> getUnreadMessages concode_elem_sep void unregister concode_elem_sep int getUnreadCount concode_elem_sep int getReceivedCount concode_elem_sep void clearOutbox concode_elem_sep void sendMessages concode_elem_sep double getReliability concode_elem_sep CommDeviceBuilder builder concode_elem_sep boolean isRegistered concode_elem_sep String toString concode_elem_sep List<Message> getOutbox concode_elem_sep void register