added method returning all motes, instead of using getMote(int) method

This commit is contained in:
fros4943 2009-02-24 15:08:20 +00:00
parent 06ed4d3f0a
commit 0bb6e99326

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: Simulation.java,v 1.41 2009/02/23 08:33:23 joxe Exp $ * $Id: Simulation.java,v 1.42 2009/02/24 15:08:20 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -521,12 +521,10 @@ public class Simulation extends Observable implements Runnable {
if (radioMediumClass != null) { if (radioMediumClass != null) {
// Create radio medium specified in config // Create radio medium specified in config
try { try {
currentRadioMedium = RadioMedium.generateRadioMedium( currentRadioMedium = RadioMedium.generateRadioMedium(radioMediumClass, this);
radioMediumClass, this);
} catch (Exception e) { } catch (Exception e) {
currentRadioMedium = null; currentRadioMedium = null;
logger.warn("Could not load radio medium class: " logger.warn("Could not load radio medium class: " + radioMediumClassName);
+ radioMediumClassName);
} }
} }
@ -544,12 +542,10 @@ public class Simulation extends Observable implements Runnable {
} }
// Check if radio medium specific config should be applied // Check if radio medium specific config should be applied
if (radioMediumClassName if (radioMediumClassName.equals(currentRadioMedium.getClass().getName())) {
.equals(currentRadioMedium.getClass().getName())) {
currentRadioMedium.setConfigXML(element.getChildren(), visAvailable); currentRadioMedium.setConfigXML(element.getChildren(), visAvailable);
} else { } else {
logger logger.info("Radio Medium changed - ignoring radio medium specific config");
.info("Radio Medium changed - ignoring radio medium specific config");
} }
} }
@ -686,6 +682,17 @@ public class Simulation extends Observable implements Runnable {
return motes.size(); return motes.size();
} }
/**
* Returns all motes in this simulation.
*
* @return Motes
*/
public Mote[] getMotes() {
Mote[] arr = new Mote[motes.size()];
motes.toArray(arr);
return arr;
}
/** /**
* Returns all mote types in simulation. * Returns all mote types in simulation.
* *