added experimental per destination delay

This commit is contained in:
fros4943 2009-02-24 15:07:01 +00:00
parent c2f7780b68
commit 06ed4d3f0a

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: RadioConnection.java,v 1.5 2008/10/29 18:23:04 fros4943 Exp $
* $Id: RadioConnection.java,v 1.6 2009/02/24 15:07:01 fros4943 Exp $
*/
package se.sics.cooja;
@ -48,6 +48,8 @@ public class RadioConnection {
private Vector<Radio> destinations = new Vector<Radio>();
private Vector<Long> destinationDelays = new Vector<Long>();
private Vector<Radio> interfered = new Vector<Radio>();
/**
@ -78,6 +80,17 @@ public class RadioConnection {
*/
public void addDestination(Radio radio) {
destinations.add(radio);
destinationDelays.add(new Long(0));
}
public void addDestination(Radio radio, Long delay) {
destinations.add(radio);
destinationDelays.add(delay);
}
public Long getDestinationDelay(Radio radio) {
int idx = destinations.indexOf(radio);
return destinationDelays.get(idx);
}
/**
@ -97,7 +110,10 @@ public class RadioConnection {
* Radio
*/
public void removeDestination(Radio radio) {
destinations.remove(radio);
int idx = destinations.indexOf(radio);
destinations.remove(idx);
destinationDelays.remove(idx);
}
/**
@ -121,26 +137,18 @@ public class RadioConnection {
* @return All destinations of this connection
*/
public Radio[] getDestinations() {
Radio[] radioArrayType;
Radio[] radioArray;
radioArrayType = new Radio[destinations.size()];
radioArray = destinations.toArray(radioArrayType);
return radioArray;
Radio[] arr = new Radio[destinations.size()];
destinations.toArray(arr);
return arr;
}
/**
* @return All radios interfered by this connection
*/
public Radio[] getInterfered() {
Radio[] radioArrayType;
Radio[] radioArray;
radioArrayType = new Radio[interfered.size()];
radioArray = interfered.toArray(radioArrayType);
return radioArray;
Radio[] arr = new Radio[interfered.size()];
interfered.toArray(arr);
return arr;
}
public String toString() {