diff --git a/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java b/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java index c5eac986e..7c21f0280 100644 --- a/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java +++ b/tools/cooja/apps/avrora/src/se/sics/cooja/avrmote/MicaZMoteType.java @@ -37,8 +37,6 @@ import java.awt.Dimension; import java.io.File; import java.util.ArrayList; import java.util.Collection; -import java.util.Vector; - import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; @@ -46,10 +44,8 @@ import javax.swing.Icon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; - import org.apache.log4j.Logger; import org.jdom.Element; - import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; import se.sics.cooja.GUI; @@ -83,8 +79,6 @@ public class MicaZMoteType implements MoteType { private String identifier = null; private String description = null; - protected Simulation simulation; - /* If source file is defined, the firmware is recompiled when loading simulations */ private File fileFirmware = null; private File fileSource = null; @@ -227,8 +221,8 @@ public class MicaZMoteType implements MoteType { return null; } - public Collection getConfigXML() { - Vector config = new Vector(); + public Collection getConfigXML(Simulation simulation) { + ArrayList config = new ArrayList(); Element element; @@ -260,7 +254,7 @@ public class MicaZMoteType implements MoteType { config.add(element); // Mote interfaces - for (Class moteInterface : getMoteInterfaceClasses()) { + for (Class moteInterface : getMoteInterfaceClasses()) { element = new Element("moteinterface"); element.setText(moteInterface.getName()); config.add(element); @@ -272,7 +266,6 @@ public class MicaZMoteType implements MoteType { public boolean setConfigXML(Simulation simulation, Collection configXML, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; ArrayList> intfClassList = new ArrayList>(); for (Element element : configXML) { @@ -325,7 +318,6 @@ public class MicaZMoteType implements MoteType { public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; /* If visualized, show compile dialog and let user configure */ if (visAvailable) { diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java index 2f24f0327..874f6291f 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/ESBMoteType.java @@ -82,7 +82,6 @@ public class ESBMoteType extends MspMoteType { public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; /* SPECIAL CASE: Cooja started in applet. * Use preconfigured Contiki firmware */ diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java index edd661570..38591b17b 100755 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/Exp5438MoteType.java @@ -73,7 +73,6 @@ public class Exp5438MoteType extends MspMoteType { public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; /* If visualized, show compile dialog and let user configure */ if (visAvailable) { diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java index 324132ee3..645cbe310 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java @@ -39,8 +39,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.Hashtable; -import java.util.Vector; - import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; @@ -48,10 +46,8 @@ import javax.swing.Icon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; - import org.apache.log4j.Logger; import org.jdom.Element; - import se.sics.cooja.ClassDescription; import se.sics.cooja.GUI; import se.sics.cooja.Mote; @@ -80,8 +76,6 @@ public abstract class MspMoteType implements MoteType { private String identifier = null; private String description = null; - protected Simulation simulation; - /* If source file is defined, the firmware is recompiled when loading simulations */ private File fileSource = null; private String compileCommands = null; @@ -223,8 +217,8 @@ public abstract class MspMoteType implements MoteType { return null; } - public Collection getConfigXML() { - Vector config = new Vector(); + public Collection getConfigXML(Simulation simulation) { + ArrayList config = new ArrayList(); Element element; @@ -259,7 +253,7 @@ public abstract class MspMoteType implements MoteType { config.add(element); // Mote interfaces - for (Class moteInterface : getMoteInterfaceClasses()) { + for (Class moteInterface : getMoteInterfaceClasses()) { element = new Element("moteinterface"); element.setText(moteInterface.getName()); config.add(element); @@ -271,7 +265,6 @@ public abstract class MspMoteType implements MoteType { public boolean setConfigXML(Simulation simulation, Collection configXML, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; ArrayList> intfClassList = new ArrayList>(); for (Element element : configXML) { diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java index 47823214b..a4659be1f 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/SkyMoteType.java @@ -80,7 +80,6 @@ public class SkyMoteType extends MspMoteType { public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; /* SPECIAL CASE: Cooja started in applet. * Use preconfigured Contiki firmware */ diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java index ebc62bfdd..6d774da3e 100755 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/TyndallMoteType.java @@ -73,7 +73,6 @@ public class TyndallMoteType extends MspMoteType { public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; /* If visualized, show compile dialog and let user configure */ if (visAvailable) { diff --git a/tools/cooja/java/se/sics/cooja/MoteType.java b/tools/cooja/java/se/sics/cooja/MoteType.java index a66b6dac6..48c374f58 100644 --- a/tools/cooja/java/se/sics/cooja/MoteType.java +++ b/tools/cooja/java/se/sics/cooja/MoteType.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: MoteType.java,v 1.10 2009/03/10 21:05:00 fros4943 Exp $ */ package se.sics.cooja; @@ -191,9 +189,11 @@ public interface MoteType { * configuration file. For example a Contiki base directory may be saved. * * @see #setConfigXML(Simulation, Collection, boolean) + * @param simulation + * Current simulation * @return XML elements representing the current mote type's config */ - public Collection getConfigXML(); + public Collection getConfigXML(Simulation simulation); /** * Sets the current mote type config depending on the given XML elements. diff --git a/tools/cooja/java/se/sics/cooja/Simulation.java b/tools/cooja/java/se/sics/cooja/Simulation.java index 58861cb53..eb56a91a0 100644 --- a/tools/cooja/java/se/sics/cooja/Simulation.java +++ b/tools/cooja/java/se/sics/cooja/Simulation.java @@ -512,7 +512,7 @@ public class Simulation extends Observable implements Runnable { element = new Element("motetype"); element.setText(moteType.getClass().getName()); - Collection moteTypeXML = moteType.getConfigXML(); + Collection moteTypeXML = moteType.getConfigXML(this); if (moteTypeXML != null) { element.addContent(moteTypeXML); } diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java index abb641d98..f7d3bad1b 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteType.java @@ -50,15 +50,12 @@ import java.util.Random; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; - import org.apache.log4j.Logger; import org.jdom.Element; - import se.sics.cooja.AbstractionLevelDescription; import se.sics.cooja.ClassDescription; import se.sics.cooja.CoreComm; @@ -194,8 +191,6 @@ public class ContikiMoteType implements MoteType { private NetworkStack netStack = NetworkStack.DEFAULT; - private Simulation simulation = null; - // Type specific class configuration private ProjectConfig myConfig = null; @@ -217,7 +212,6 @@ public class ContikiMoteType implements MoteType { public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) throws MoteTypeCreationException { - this.simulation = simulation; myConfig = simulation.getGUI().getProjectConfig().clone(); if (visAvailable) { @@ -1270,7 +1264,7 @@ public class ContikiMoteType implements MoteType { smallPane.add(BorderLayout.WEST, label); panel.add(smallPane); - for (Class intf : moteInterfacesClasses) { + for (Class intf : moteInterfacesClasses) { smallPane = new JPanel(new BorderLayout()); label = new JLabel(intf.getSimpleName()); smallPane.add(BorderLayout.EAST, label); @@ -1294,8 +1288,8 @@ public class ContikiMoteType implements MoteType { return panel; } - public Collection getConfigXML() { - Vector config = new Vector(); + public Collection getConfigXML(Simulation simulation) { + ArrayList config = new ArrayList(); Element element; element = new Element("identifier"); @@ -1341,7 +1335,6 @@ public class ContikiMoteType implements MoteType { File oldVersionSource = null; moteInterfacesClasses = new ArrayList>(); - this.simulation = simulation; for (Element element : configXML) { String name = element.getName(); diff --git a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java index 8ac139bd5..a58fcb82f 100644 --- a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java +++ b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java @@ -208,7 +208,7 @@ public abstract class AbstractApplicationMoteType implements MoteType { return myConfig; } - public Collection getConfigXML() { + public Collection getConfigXML(Simulation simulation) { ArrayList config = new ArrayList(); Element element; diff --git a/tools/cooja/java/se/sics/cooja/motes/ImportAppMoteType.java b/tools/cooja/java/se/sics/cooja/motes/ImportAppMoteType.java index 8563ab528..821d9dda2 100644 --- a/tools/cooja/java/se/sics/cooja/motes/ImportAppMoteType.java +++ b/tools/cooja/java/se/sics/cooja/motes/ImportAppMoteType.java @@ -72,8 +72,8 @@ public class ImportAppMoteType extends AbstractApplicationMoteType { setDescription("Imported App Mote Type #" + identifier); } - public Collection getConfigXML() { - Collection config = super.getConfigXML(); + public Collection getConfigXML(Simulation simulation) { + Collection config = super.getConfigXML(simulation); if (moteClassPath != null) { Element element = new Element("motepath");