BoolCollectorDevice.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 boolean, which could act as an actuator
  5. *
  6. * @author Andreas T. Meyer-Berg
  7. */
  8. public class BoolCollectorDevice extends SmartDevice implements BoolCollector {
  9. /**
  10. * Name of the information
  11. */
  12. private String infoName;
  13. /**
  14. * last value
  15. */
  16. private boolean val;
  17. /**
  18. * Create a new Collector with the given name
  19. * @param name name of the device
  20. */
  21. public BoolCollectorDevice(String name) {
  22. super(name);
  23. init();
  24. }
  25. /**
  26. * Creates a new collector
  27. */
  28. public BoolCollectorDevice() {
  29. super();
  30. init();
  31. }
  32. /**
  33. * initializes the fields
  34. */
  35. private void init(){
  36. infoName = "doorOpen";
  37. val = false;
  38. }
  39. @Override
  40. public void setBCinfoName(String name) {
  41. this.infoName = name;
  42. }
  43. @Override
  44. public String getBCinfoName() {
  45. return infoName;
  46. }
  47. @Override
  48. public boolean getBCval() {
  49. return val;
  50. }
  51. @Override
  52. public void setBCval(boolean val) {
  53. this.val = val;
  54. }
  55. }