Quellcode durchsuchen

Adds two Collector Devices

Andreas T. Meyer-Berg vor 5 Jahren
Ursprung
Commit
088c986dff

+ 4 - 4
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/devices/BoolCollector.java

@@ -12,24 +12,24 @@ public interface BoolCollector {
 	 * Name of the information that should be collected
 	 * @param name name of the collected information
 	 */
-	public void setFCinfoName(String name);
+	public void setBCinfoName(String name);
 	
 	/**
 	 * Return the name of the collected information
 	 * @return name of the collected information
 	 */
-	public String getFCinfoName();
+	public String getBCinfoName();
 	
 	/**
 	 * Return the current value of the collector
 	 * @return value
 	 */
-	public boolean getFCval();
+	public boolean getBCval();
 	
 	/**
 	 * Set the current value of the collector
 	 * @param val new value
 	 */
-	public void setFCval(boolean val);
+	public void setBCval(boolean val);
 
 }

+ 64 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/devices/BoolCollectorDevice.java

@@ -0,0 +1,64 @@
+package de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices;
+
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
+
+/**
+ * Collector for boolean, which could act as an actuator
+ *
+ * @author Andreas T. Meyer-Berg
+ */
+public class BoolCollectorDevice extends SmartDevice implements BoolCollector {
+
+	/**
+	 * Name of the information
+	 */
+	private String infoName;
+	/**
+	 * last value
+	 */
+	private boolean val;
+	/**
+	 * Create a new Collector with the given name
+	 * @param name name of the device
+	 */
+	public BoolCollectorDevice(String name) {
+		super(name);
+		init();
+	}
+	
+	/**
+	 * Creates a new collector
+	 */
+	public BoolCollectorDevice() {
+		super();
+		init();
+	}
+	
+	/**
+	 * initializes the fields
+	 */
+	private void init(){
+		infoName = "doorOpen";
+		val = false;
+	}
+	
+	@Override
+	public void setBCinfoName(String name) {
+		this.infoName = name;
+	}
+
+	@Override
+	public String getBCinfoName() {
+		return infoName;
+	}
+
+	@Override
+	public boolean getBCval() {
+		return val;
+	}
+
+	@Override
+	public void setBCval(boolean val) {
+		this.val = val;
+	}
+}

+ 64 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/devices/FloatCollectorDevice.java

@@ -0,0 +1,64 @@
+package de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices;
+
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
+
+/**
+ * Collector for floats, which could act as an actuator
+ *
+ * @author Andreas T. Meyer-Berg
+ */
+public class FloatCollectorDevice extends SmartDevice implements FloatCollector {
+
+	/**
+	 * Name of the information
+	 */
+	private String infoName;
+	/**
+	 * last value
+	 */
+	private float val;
+	/**
+	 * Create a new Collector with the given name
+	 * @param name name of the device
+	 */
+	public FloatCollectorDevice(String name) {
+		super(name);
+		init();
+	}
+	
+	/**
+	 * Creates a new collector
+	 */
+	public FloatCollectorDevice() {
+		super();
+		init();
+	}
+	
+	/**
+	 * initializes the fields
+	 */
+	private void init(){
+		infoName = "temperature";
+		val = 22;
+	}
+	
+	@Override
+	public void setFCinfoName(String name) {
+		this.infoName = name;
+	}
+
+	@Override
+	public String getFCinfoName() {
+		return infoName;
+	}
+
+	@Override
+	public float getFCval() {
+		return val;
+	}
+
+	@Override
+	public void setFCval(long val) {
+		this.val = val;
+	}
+}