cleaned up some unnecessary methods: empty mote constructors (created from mote type), setInterfaces/setMoteType methods

This commit is contained in:
Fredrik Osterlind 2012-05-24 14:06:09 +02:00
parent a437d06ba3
commit 4ea830ad45
7 changed files with 7 additions and 78 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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<Element> configXML, boolean visAvailable);
/**
* Called when mote is removed from simulation
* Called when mote is removed from simulation
*/
public void removed();

View file

@ -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();