added experimental per destination delay
This commit is contained in:
parent
c2f7780b68
commit
06ed4d3f0a
1 changed files with 24 additions and 16 deletions
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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;
|
package se.sics.cooja;
|
||||||
|
@ -48,6 +48,8 @@ public class RadioConnection {
|
||||||
|
|
||||||
private Vector<Radio> destinations = new Vector<Radio>();
|
private Vector<Radio> destinations = new Vector<Radio>();
|
||||||
|
|
||||||
|
private Vector<Long> destinationDelays = new Vector<Long>();
|
||||||
|
|
||||||
private Vector<Radio> interfered = new Vector<Radio>();
|
private Vector<Radio> interfered = new Vector<Radio>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,6 +80,17 @@ public class RadioConnection {
|
||||||
*/
|
*/
|
||||||
public void addDestination(Radio radio) {
|
public void addDestination(Radio radio) {
|
||||||
destinations.add(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
|
* Radio
|
||||||
*/
|
*/
|
||||||
public void removeDestination(Radio 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
|
* @return All destinations of this connection
|
||||||
*/
|
*/
|
||||||
public Radio[] getDestinations() {
|
public Radio[] getDestinations() {
|
||||||
Radio[] radioArrayType;
|
Radio[] arr = new Radio[destinations.size()];
|
||||||
Radio[] radioArray;
|
destinations.toArray(arr);
|
||||||
|
return arr;
|
||||||
radioArrayType = new Radio[destinations.size()];
|
|
||||||
radioArray = destinations.toArray(radioArrayType);
|
|
||||||
|
|
||||||
return radioArray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return All radios interfered by this connection
|
* @return All radios interfered by this connection
|
||||||
*/
|
*/
|
||||||
public Radio[] getInterfered() {
|
public Radio[] getInterfered() {
|
||||||
Radio[] radioArrayType;
|
Radio[] arr = new Radio[interfered.size()];
|
||||||
Radio[] radioArray;
|
interfered.toArray(arr);
|
||||||
|
return arr;
|
||||||
radioArrayType = new Radio[interfered.size()];
|
|
||||||
radioArray = interfered.toArray(radioArrayType);
|
|
||||||
|
|
||||||
return radioArray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
Loading…
Reference in a new issue