From 4ea830ad45772f573dba257f8a853849ee1f5295 Mon Sep 17 00:00:00 2001 From: Fredrik Osterlind Date: Thu, 24 May 2012 14:06:09 +0200 Subject: [PATCH] cleaned up some unnecessary methods: empty mote constructors (created from mote type), setInterfaces/setMoteType methods --- .../src/se/sics/cooja/mspmote/ESBMote.java | 4 -- .../se/sics/cooja/mspmote/Exp5438Mote.java | 4 -- .../src/se/sics/cooja/mspmote/MspMote.java | 7 ---- .../src/se/sics/cooja/mspmote/SkyMote.java | 8 +--- .../se/sics/cooja/mspmote/TyndallMote.java | 5 --- tools/cooja/java/se/sics/cooja/Mote.java | 42 +------------------ .../sics/cooja/contikimote/ContikiMote.java | 15 ++----- 7 files changed, 7 insertions(+), 78 deletions(-) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMote.java index 8c4fb6608..b5d8facd3 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMote.java @@ -46,10 +46,6 @@ public class ESBMote extends MspMote { public ESBNode esbNode = null; - public ESBMote() { - super(); - } - public ESBMote(MspMoteType moteType, Simulation sim) { super(moteType, sim); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438Mote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438Mote.java index 797b285ee..117fa6662 100755 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438Mote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438Mote.java @@ -44,10 +44,6 @@ public class Exp5438Mote extends MspMote { public Exp5438Node exp5438Node = null; - public Exp5438Mote() { - super(); - } - public Exp5438Mote(MspMoteType moteType, Simulation sim) { super(moteType, sim); } diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java index f1882e164..6f95ab78c 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java @@ -100,13 +100,6 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc private int heapStartAddress; private StackOverflowObservable stackOverflowObservable = new StackOverflowObservable(); - public MspMote() { - myMoteType = null; - myCpu = null; - myMemory = null; - myMoteInterfaceHandler = null; - } - public MspMote(MspMoteType moteType, Simulation simulation) { this.simulation = simulation; myMoteType = moteType; diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java index fa0eca844..393703430 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMote.java @@ -48,10 +48,6 @@ public class SkyMote extends MspMote { public SkyNode skyNode = null; - public SkyMote() { - super(); - } - public SkyMote(MspMoteType moteType, Simulation sim) { super(moteType, sim); } @@ -61,7 +57,7 @@ public class SkyMote extends MspMote { skyNode = new SkyNode(); registry = skyNode.getRegistry(); skyNode.setFlash(new CoojaM25P80(skyNode.getCPU())); - + prepareMote(fileELF, skyNode); } catch (Exception e) { logger.fatal("Error when creating Sky mote: ", e); @@ -98,7 +94,7 @@ public class SkyMote extends MspMote { ); } }*/ - + public void idUpdated(int newID) { skyNode.setNodeID(newID); diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMote.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMote.java index 6672a9399..f3f4f051b 100755 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMote.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMote.java @@ -34,7 +34,6 @@ import java.io.File; import org.apache.log4j.Logger; import se.sics.cooja.Simulation; -import se.sics.mspsim.platform.ti.Exp5438Node; import se.sics.mspsim.platform.tyndall.TyndallNode; /** @@ -45,10 +44,6 @@ public class TyndallMote extends MspMote { public TyndallNode tyndallNode = null; - public TyndallMote() { - super(); - } - public TyndallMote(MspMoteType moteType, Simulation sim) { super(moteType, sim); } diff --git a/tools/cooja/java/se/sics/cooja/Mote.java b/tools/cooja/java/se/sics/cooja/Mote.java index 081a5a524..635666d62 100644 --- a/tools/cooja/java/se/sics/cooja/Mote.java +++ b/tools/cooja/java/se/sics/cooja/Mote.java @@ -23,8 +23,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: Mote.java,v 1.9 2010/10/12 10:58:31 fros4943 Exp $ */ package se.sics.cooja; @@ -50,7 +48,7 @@ public interface Mote { * @return Unique mote ID */ public int getID(); - + /** * Returns the interface handler of this mote. * @@ -59,15 +57,6 @@ public interface Mote { */ public MoteInterfaceHandler getInterfaces(); - /** - * Sets the interface handler of this mote. - * - * @param moteInterfaceHandler - * New interface handler - * @see #getInterfaces() - */ - public void setInterfaces(MoteInterfaceHandler moteInterfaceHandler); - /** * Returns the memory of this mote. * @@ -76,15 +65,6 @@ public interface Mote { */ public MoteMemory getMemory(); - /** - * Sets the memory of this mote. - * - * @see #getMemory() - * @param memory - * Mote memory - */ - public void setMemory(MoteMemory memory); - /** * Returns mote type. * @@ -93,15 +73,6 @@ public interface Mote { */ public MoteType getType(); - /** - * Sets mote type to given argument. - * - * @see #getType() - * @param type - * New type - */ - public void setType(MoteType type); - /** * Returns simulation which holds this mote. * @@ -110,15 +81,6 @@ public interface Mote { */ public Simulation getSimulation(); - /** - * Sets the simulation which holds this mote. - * - * @see #getSimulation() - * @param simulation - * Simulation - */ - public void setSimulation(Simulation simulation); - /** * Returns XML elements representing the current config of this mote. This is * fetched by the simulator for example when saving a simulation configuration @@ -145,7 +107,7 @@ public interface Mote { Collection configXML, boolean visAvailable); /** - * Called when mote is removed from simulation + * Called when mote is removed from simulation */ public void removed(); diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java index 2130d1fcf..d91677a71 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java @@ -68,15 +68,6 @@ public class ContikiMote extends AbstractWakeupMote implements Mote { private SectionMoteMemory myMemory = null; private MoteInterfaceHandler myInterfaceHandler = null; - /** - * Creates a new uninitialized Contiki mote. - * - * This mote needs at least a type, a memory, a mote interface handler - * and to be connected to a simulation. - */ - public ContikiMote() { - } - /** * Creates a new mote of given type. * Both the initial mote memory and the interface handler @@ -90,14 +81,14 @@ public class ContikiMote extends AbstractWakeupMote implements Mote { this.myType = moteType; this.myMemory = moteType.createInitialMemory(); this.myInterfaceHandler = new MoteInterfaceHandler(this, moteType.getMoteInterfaceClasses()); - + requestImmediateWakeup(); } public int getID() { return myInterfaceHandler.getMoteID().getMoteID(); } - + public MoteInterfaceHandler getInterfaces() { return myInterfaceHandler; } @@ -152,7 +143,7 @@ public class ContikiMote extends AbstractWakeupMote implements Mote { /* Copy mote memory from Contiki */ myType.getCoreMemory(myMemory); - + /* Poll mote interfaces */ myMemory.pollForMemoryChanges(); myInterfaceHandler.doActiveActionsAfterTick();