FloatCollectorDevice.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices;
  2. import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
  3. /**
  4. * Collector for floats, which could act as an actuator
  5. *
  6. * @author Andreas T. Meyer-Berg
  7. */
  8. public class FloatCollectorDevice extends SmartDevice implements FloatCollector {
  9. /**
  10. * Name of the information
  11. */
  12. private String infoName;
  13. /**
  14. * last value
  15. */
  16. private float val;
  17. /**
  18. * Create a new Collector with the given name
  19. * @param name name of the device
  20. */
  21. public FloatCollectorDevice(String name) {
  22. super(name);
  23. init();
  24. }
  25. /**
  26. * Creates a new collector
  27. */
  28. public FloatCollectorDevice() {
  29. super();
  30. init();
  31. }
  32. /**
  33. * initializes the fields
  34. */
  35. private void init(){
  36. infoName = "temperature";
  37. val = 22;
  38. }
  39. @Override
  40. public void setFCinfoName(String name) {
  41. this.infoName = name;
  42. }
  43. @Override
  44. public String getFCinfoName() {
  45. return infoName;
  46. }
  47. @Override
  48. public float getFCval() {
  49. return val;
  50. }
  51. @Override
  52. public void setFCval(float val) {
  53. this.val = val;
  54. }
  55. }