Cooja: Give access to uninitialized motes
This commit is contained in:
parent
becd2d4e15
commit
a3eb42387f
|
@ -59,6 +59,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
/*private static long EVENT_COUNTER = 0;*/
|
/*private static long EVENT_COUNTER = 0;*/
|
||||||
|
|
||||||
private Vector<Mote> motes = new Vector<Mote>();
|
private Vector<Mote> motes = new Vector<Mote>();
|
||||||
|
private Vector<Mote> motesUninit = new Vector<Mote>();
|
||||||
|
|
||||||
private Vector<MoteType> moteTypes = new Vector<MoteType>();
|
private Vector<MoteType> moteTypes = new Vector<MoteType>();
|
||||||
|
|
||||||
|
@ -819,6 +820,7 @@ public class Simulation extends Observable implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
motes.add(mote);
|
motes.add(mote);
|
||||||
|
motesUninit.remove(mote);
|
||||||
currentRadioMedium.registerMote(mote, Simulation.this);
|
currentRadioMedium.registerMote(mote, Simulation.this);
|
||||||
|
|
||||||
/* Notify mote interfaces that node was added */
|
/* Notify mote interfaces that node was added */
|
||||||
|
@ -838,6 +840,9 @@ public class Simulation extends Observable implements Runnable {
|
||||||
/* Add mote from simulation thread */
|
/* Add mote from simulation thread */
|
||||||
invokeSimulationThread(addMote);
|
invokeSimulationThread(addMote);
|
||||||
}
|
}
|
||||||
|
//Add to list of uninitialized motes
|
||||||
|
motesUninit.add(mote);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -868,6 +873,24 @@ public class Simulation extends Observable implements Runnable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns uninitialised simulation mote with with given ID.
|
||||||
|
*
|
||||||
|
* @param id ID
|
||||||
|
* @return Mote or null
|
||||||
|
* @see Mote#getID()
|
||||||
|
*/
|
||||||
|
public Mote getMoteWithIDUninit(int id) {
|
||||||
|
for (Mote m: motesUninit) {
|
||||||
|
if (m.getID() == id) {
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns number of motes in this simulation.
|
* Returns number of motes in this simulation.
|
||||||
*
|
*
|
||||||
|
@ -888,6 +911,16 @@ public class Simulation extends Observable implements Runnable {
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns uninitialised motes
|
||||||
|
*
|
||||||
|
* @return Motes
|
||||||
|
*/
|
||||||
|
public Mote[] getMotesUninit() {
|
||||||
|
return motesUninit.toArray(new Mote[motesUninit.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all mote types in simulation.
|
* Returns all mote types in simulation.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue