HolonSwitch.java 601 B

123456789101112131415161718192021222324252627282930313233
  1. package classes;
  2. public class HolonSwitch extends CpsObject {
  3. /*
  4. * True, if this wire is working (capable of carrying electricity), else
  5. * false
  6. */
  7. boolean isWorking;
  8. public HolonSwitch(String ObjName) {
  9. super(ObjName);
  10. isWorking = false;
  11. }
  12. public HolonSwitch(String ObjName, String obj) {
  13. super(ObjName);
  14. super.name = obj;
  15. isWorking = false;
  16. }
  17. public HolonSwitch(CpsObject obj) {
  18. super(obj);
  19. this.isWorking = ((HolonSwitch)obj).getStates();
  20. }
  21. public void switchState() {
  22. this.isWorking = !isWorking;
  23. }
  24. public boolean getStates() {
  25. return this.isWorking;
  26. }
  27. }