|
@@ -1,66 +1,48 @@
|
|
|
package de.tu_darmstadt.tk.SmartHomeNetworkSim.core;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
|
|
|
/**
|
|
|
* Physical Link medium for SmartDevices, which connects two or more devices and allows communication between them
|
|
|
*
|
|
|
* @author Andreas T. Meyer-Berg
|
|
|
*/
|
|
|
-public class Link {
|
|
|
-
|
|
|
- /**
|
|
|
- * name of the connection
|
|
|
- */
|
|
|
- private String name;
|
|
|
-
|
|
|
- /**
|
|
|
- * Devices connected by this Link
|
|
|
- */
|
|
|
- private List<SmartDevice> devices;
|
|
|
-
|
|
|
- /**
|
|
|
- * Initializes a Link with name and an empty devices list.
|
|
|
- * @param name
|
|
|
- */
|
|
|
- public Link(String name){
|
|
|
- this.name = name;
|
|
|
- this.devices = new ArrayList<SmartDevice>();
|
|
|
- }
|
|
|
-
|
|
|
+public interface Link {
|
|
|
/**
|
|
|
* @return the name
|
|
|
*/
|
|
|
- public String getName() {
|
|
|
- return name;
|
|
|
- }
|
|
|
+ public String getName();
|
|
|
|
|
|
/**
|
|
|
* @param name the name to set
|
|
|
*/
|
|
|
- public void setName(String name) {
|
|
|
- this.name = name;
|
|
|
- }
|
|
|
+ public void setName(String name);
|
|
|
|
|
|
/**
|
|
|
* @return the devices
|
|
|
*/
|
|
|
- public List<SmartDevice> getDevices() {
|
|
|
- return devices;
|
|
|
- }
|
|
|
+ public Collection<SmartDevice> getDevices();
|
|
|
|
|
|
/**
|
|
|
* @param device the devices to add
|
|
|
*/
|
|
|
- public void addDevice(SmartDevice device) {
|
|
|
- this.devices.add(device);
|
|
|
- }
|
|
|
+ public void addDevice(SmartDevice device);
|
|
|
|
|
|
/**
|
|
|
* @param device the devices to remove
|
|
|
*/
|
|
|
- public void removeDevice(SmartDevice device) {
|
|
|
- this.devices.remove(device);
|
|
|
- }
|
|
|
+ public void removeDevice(SmartDevice device);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Simulates an intervall starting at startTime for a given duration
|
|
|
+ * @param startTime
|
|
|
+ * @param duration
|
|
|
+ */
|
|
|
+ public void simulateTimeIntervall(long startTime, long duration);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns all packets which where sent during the last Simulation time step
|
|
|
+ * @return packets, which were sent during the last time step
|
|
|
+ */
|
|
|
+ public Collection<Packet> getPackets();
|
|
|
}
|