added tostring method

This commit is contained in:
fros4943 2008-10-29 18:23:04 +00:00
parent fdcfbd0e62
commit d6fff91861

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.4 2007/02/28 09:47:55 fros4943 Exp $
* $Id: RadioConnection.java,v 1.5 2008/10/29 18:23:04 fros4943 Exp $
*/
package se.sics.cooja;
@ -41,7 +41,7 @@ import se.sics.cooja.interfaces.Radio;
* to receive data sent by the source radio, and the interfered radios are not.
*
* @see RadioMedium
* @author Fredrik Osterlind
* @author Fredrik Österlind
*/
public class RadioConnection {
private Radio source;
@ -125,7 +125,7 @@ public class RadioConnection {
Radio[] radioArray;
radioArrayType = new Radio[destinations.size()];
radioArray = (Radio[]) destinations.toArray(radioArrayType);
radioArray = destinations.toArray(radioArrayType);
return radioArray;
}
@ -138,9 +138,21 @@ public class RadioConnection {
Radio[] radioArray;
radioArrayType = new Radio[interfered.size()];
radioArray = (Radio[]) interfered.toArray(radioArrayType);
radioArray = interfered.toArray(radioArrayType);
return radioArray;
}
public String toString() {
if (destinations.size() == 0) {
return "Radio connection: " + source.getMote() + " -> none";
}
if (destinations.size() == 1) {
return "Radio connection: " + source.getMote() + " -> " + destinations.get(0).getMote();
}
return "Radio connection: " + source.getMote() + " -> " + destinations.size() + " motes";
}
}