Tom Houben Tom Houben - 1 year ago 36
Java Question

Rinsim: Changing the range of a CommDevice

Is there a possibility to change the range of a CommDevice? We would like to broadcast a message with a small range and gradually expand the range when no response is received.

Answer Source

The range of a CommDevice is meant to model the physical limitations of a communication device. The current implementation assumes that these limitations cannot change over time.

The best way of implementing the behaviour that you want is to implement an additional method for broadcasting in CommDevice:

public void broadcast(MessageContents contents, double range){ 
  checkRegistered();
  // construct a predicate based on 'range' and 'rangePredicate' (if it exists)
  outbox.add(Message.createBroadcast(user, contents, predicate));
}

If you want, you can send a pull request, I will accept it if it is well tested.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download