added static connection ID for debugging purposes

This commit is contained in:
fros4943 2009-05-26 13:37:26 +00:00
parent 7c2e0a4b48
commit 1b937d8287

View file

@ -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.9 2009/05/04 15:34:28 fros4943 Exp $ * $Id: RadioConnection.java,v 1.10 2009/05/26 13:37:26 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -44,6 +44,10 @@ import se.sics.cooja.interfaces.Radio;
* @author Fredrik Osterlind * @author Fredrik Osterlind
*/ */
public class RadioConnection { public class RadioConnection {
private static int ID = 0; /* Unique radio connection ID. For internal use */
private int id;
private Radio source; private Radio source;
private Vector<Radio> destinations = new Vector<Radio>(); private Vector<Radio> destinations = new Vector<Radio>();
@ -63,6 +67,8 @@ public class RadioConnection {
public RadioConnection(Radio sourceRadio) { public RadioConnection(Radio sourceRadio) {
this.source = sourceRadio; this.source = sourceRadio;
startTime = sourceRadio.getMote().getSimulation().getSimulationTime(); startTime = sourceRadio.getMote().getSimulation().getSimulationTime();
this.id = ID++;
} }
public long getStartTime() { public long getStartTime() {
@ -162,13 +168,13 @@ public class RadioConnection {
public String toString() { public String toString() {
if (destinations.size() == 0) { if (destinations.size() == 0) {
return "Radio connection: " + source.getMote() + " -> none"; return id + ": Radio connection: " + source.getMote() + " -> none";
} }
if (destinations.size() == 1) { if (destinations.size() == 1) {
return "Radio connection: " + source.getMote() + " -> " + destinations.get(0).getMote(); return id + ": Radio connection: " + source.getMote() + " -> " + destinations.get(0).getMote();
} }
return "Radio connection: " + source.getMote() + " -> " + destinations.size() + " motes"; return id + ": Radio connection: " + source.getMote() + " -> " + destinations.size() + " motes";
} }