|
@@ -4,10 +4,6 @@ import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Observable;
|
|
|
|
|
|
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.protocols.MQTT_protocol;
|
|
|
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.simpleImplementation.SimpleLink;
|
|
|
-import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.simpleImplementation.SimpleProtocol;
|
|
|
-
|
|
|
/**
|
|
|
* Model of the smart home, which contains all the important parts of the simulation, like {@link SmartDevice} and their {@link Link}.
|
|
|
*
|
|
@@ -19,21 +15,6 @@ public class Model extends Observable{
|
|
|
private List<Link> connectionNetworks;
|
|
|
private List<Connection> connections;
|
|
|
|
|
|
- /*
|
|
|
- * standard classes of the model, and user imported classes
|
|
|
- */
|
|
|
- private LinkedList<Class<? extends Protocol>> standardProtocols = new LinkedList<Class<? extends Protocol>>();
|
|
|
- private LinkedList<Class<? extends Protocol>> importedProtocols = new LinkedList<Class<? extends Protocol>>();
|
|
|
-
|
|
|
- private LinkedList<Class<? extends Link>> standardLinks = new LinkedList<Class<? extends Link>>();
|
|
|
- private LinkedList<Class<? extends Link>> importedLinks = new LinkedList<Class<? extends Link>>();
|
|
|
-
|
|
|
- private LinkedList<Class<? extends Connection>> standardConnections = new LinkedList<Class<? extends Connection>>();
|
|
|
- private LinkedList<Class<? extends Connection>> importedConnections = new LinkedList<Class<? extends Connection>>();
|
|
|
-
|
|
|
- private LinkedList<Class<? extends SmartDevice>> standardSmartDevices = new LinkedList<Class<? extends SmartDevice>>();
|
|
|
- private LinkedList<Class<? extends SmartDevice>> importedSmartDevices = new LinkedList<Class<? extends SmartDevice>>();
|
|
|
-
|
|
|
/**
|
|
|
* Width of the smart home model, 0 <= device.x < width
|
|
|
*/
|
|
@@ -73,16 +54,6 @@ public class Model extends Observable{
|
|
|
devices = new LinkedList<SmartDevice>();
|
|
|
connectionNetworks = new LinkedList<Link>();
|
|
|
connections = new LinkedList<Connection>();
|
|
|
-
|
|
|
- //Add the default Classes
|
|
|
- standardProtocols.add(MQTT_protocol.class);
|
|
|
- standardProtocols.add(SimpleProtocol.class);
|
|
|
-
|
|
|
- standardLinks.add(SimpleLink.class);
|
|
|
-
|
|
|
- standardSmartDevices.add(SmartDevice.class);
|
|
|
-
|
|
|
- standardConnections.add(ConnectionPerformance.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -187,114 +158,6 @@ public class Model extends Observable{
|
|
|
public void setSim(SimulationManager sim) {
|
|
|
this.sim = sim;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns Protocol Classes of the Model
|
|
|
- * @return available Protocol Classes
|
|
|
- */
|
|
|
- public LinkedList<Class<? extends Protocol>> getProtocolClasses(){
|
|
|
- LinkedList<Class<? extends Protocol>> export = new LinkedList<Class<? extends Protocol>>();
|
|
|
- export.addAll(standardProtocols);
|
|
|
- export.addAll(importedProtocols);
|
|
|
- return export;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Adds newProtocol to the available protocol classes
|
|
|
- * @param newProtocol new Protocol Class to be added
|
|
|
- */
|
|
|
- public void addProtocolClass(Class<? extends Protocol> newProtocol){
|
|
|
- importedProtocols.add(newProtocol);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Removes Protocol from the available protocol classes
|
|
|
- * @param remove protocol to be removed
|
|
|
- */
|
|
|
- public void removeProtocolClass(Class<? extends Protocol> remove){
|
|
|
- importedProtocols.remove(remove);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns Link Classes of the Model
|
|
|
- * @return available Link classes
|
|
|
- */
|
|
|
- public LinkedList<Class<? extends Link>> getLinkClasses(){
|
|
|
- LinkedList<Class<? extends Link>> export = new LinkedList<Class<? extends Link>>();
|
|
|
- export.addAll(standardLinks);
|
|
|
- export.addAll(importedLinks);
|
|
|
- return export;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Adds newLink to the available Link classes
|
|
|
- * @param newLink new Link class to be added
|
|
|
- */
|
|
|
- public void addLinkClass(Class<? extends Link> newLink){
|
|
|
- importedLinks.add(newLink);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Removes Link from the available Link classes
|
|
|
- * @param remove Link Class to be removed
|
|
|
- */
|
|
|
- public void removeLinkClass(Class<? extends Link> remove){
|
|
|
- importedLinks.remove(remove);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns Connection Classes of the Model
|
|
|
- * @return available Connections classes
|
|
|
- */
|
|
|
- public LinkedList<Class<? extends Connection>> getConnectionClasses(){
|
|
|
- LinkedList<Class<? extends Connection>> export = new LinkedList<Class<? extends Connection>>();
|
|
|
- export.addAll(standardConnections);
|
|
|
- export.addAll(importedConnections);
|
|
|
- return export;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Adds Connection Class to the available Connection Classes
|
|
|
- * @param newConnection new Connection to be added
|
|
|
- */
|
|
|
- public void addConnectionClass(Class<? extends Connection> newConnection){
|
|
|
- importedConnections.add(newConnection);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Removes Connection Class from the available Connection Classes
|
|
|
- * @param remove Connection Class to be removed
|
|
|
- */
|
|
|
- public void removeConnectionClass(Class<? extends Connection> remove){
|
|
|
- importedConnections.remove(remove);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns SmartDevice Classes of the Model
|
|
|
- * @return available SmartDevice Classes
|
|
|
- */
|
|
|
- public LinkedList<Class<? extends SmartDevice>> getSmartDeviceClasses(){
|
|
|
- LinkedList<Class<? extends SmartDevice>> export = new LinkedList<Class<? extends SmartDevice>>();
|
|
|
- export.addAll(standardSmartDevices);
|
|
|
- export.addAll(importedSmartDevices);
|
|
|
- return export;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Adds newSmartDevice Class to the available SmartDevice Classes
|
|
|
- * @param newSmartDevice new SmartDevice Class to be added
|
|
|
- */
|
|
|
- public void addSmartDeviceClass(Class<? extends SmartDevice> newSmartDevice){
|
|
|
- importedSmartDevices.add(newSmartDevice);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Removes SmartDevice Class from the available SmartDevice Classes
|
|
|
- * @param remove SmartDevice Class to be removed
|
|
|
- */
|
|
|
- public void removeSmartDeviceClass(Class<? extends SmartDevice> remove){
|
|
|
- importedSmartDevices.remove(remove);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* @return the configurations
|