DeviceStatus.java 835 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. *
  3. */
  4. package com.xcgl.dataview.entity;
  5. /**
  6. * @author xzx
  7. *
  8. */
  9. public enum DeviceStatus {
  10. NORMAL(0, "正常"), ABNORMAL(1, "报警"), ABNORMAL_SHANGXIAN(11,"超出上限"), ABNORMAL_XIAXIAN(12, "低于下限"), OFFLINE(21,"离线");
  11. private int index;
  12. private String text;
  13. public static DeviceStatus getDeviceStatus(int index) {
  14. for(DeviceStatus ds :DeviceStatus.values()) {
  15. if(ds.getIndex() == index) {
  16. return ds;
  17. }
  18. }
  19. return null;
  20. }
  21. private DeviceStatus(int index, String text) {
  22. this.index = index;
  23. this.text = text;
  24. }
  25. public int getIndex() {
  26. return index;
  27. }
  28. public void setIndex(int index) {
  29. this.index = index;
  30. }
  31. public String getText() {
  32. return text;
  33. }
  34. public void setText(String text) {
  35. this.text = text;
  36. }
  37. public String toString() {
  38. return getText();
  39. }
  40. }