mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-11-08 23:08:29 +00:00
added method that returns a mote with the given id
This commit is contained in:
parent
07ee8458e7
commit
cd8047bc77
@ -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.62 2010/02/04 15:32:41 nifi Exp $
|
* $Id: Simulation.java,v 1.63 2010/02/23 21:55:55 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja;
|
package se.sics.cooja;
|
||||||
@ -768,16 +768,33 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a mote from this simulation.
|
* Returns simulation mote at given list position.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos Internal list position of mote
|
||||||
* Internal list position of mote
|
|
||||||
* @return Mote
|
* @return Mote
|
||||||
|
* @see #getMotesCount()
|
||||||
|
* @see #getMoteWithID(int)
|
||||||
*/
|
*/
|
||||||
public Mote getMote(int pos) {
|
public Mote getMote(int pos) {
|
||||||
return motes.get(pos);
|
return motes.get(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns simulation with with given ID.
|
||||||
|
*
|
||||||
|
* @param id ID
|
||||||
|
* @return Mote or null
|
||||||
|
* @see Mote#getID()
|
||||||
|
*/
|
||||||
|
public Mote getMoteWithID(int id) {
|
||||||
|
for (Mote m: motes) {
|
||||||
|
if (m.getID() == id) {
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of motes in this simulation.
|
* Returns number of motes in this simulation.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user