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

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