enables sharing mote-specific properties
This commit is contained in:
parent
7043c25cd9
commit
5636b019b3
|
@ -148,4 +148,7 @@ public interface Mote {
|
||||||
* Called when mote is removed from simulation
|
* Called when mote is removed from simulation
|
||||||
*/
|
*/
|
||||||
public void removed();
|
public void removed();
|
||||||
|
|
||||||
|
public void setProperty(String key, Object obj);
|
||||||
|
public Object getProperty(String key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
package se.sics.cooja.motes;
|
package se.sics.cooja.motes;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.Mote;
|
import se.sics.cooja.Mote;
|
||||||
|
@ -130,4 +132,18 @@ public abstract class AbstractWakeupMote implements Mote {
|
||||||
|
|
||||||
public void removed() {
|
public void removed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Object> properties = null;
|
||||||
|
public void setProperty(String key, Object obj) {
|
||||||
|
if (properties == null) {
|
||||||
|
properties = new HashMap<String, Object>();
|
||||||
|
}
|
||||||
|
properties.put(key, obj);
|
||||||
|
}
|
||||||
|
public Object getProperty(String key) {
|
||||||
|
if (properties == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return properties.get(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue