You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ErrorReportStatus.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2006-2017 DMDirc Developers
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5. * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
  6. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  7. * permit persons to whom the Software is furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
  10. * Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  14. * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. */
  17. package com.dmdirc.logger;
  18. /**
  19. * Error report status.
  20. */
  21. public enum ErrorReportStatus {
  22. /** Not applicable. */
  23. NOT_APPLICABLE("Not applicable", true),
  24. /** Finished state. */
  25. FINISHED("Finished", true),
  26. /** Sending state. */
  27. SENDING("Sending...", false),
  28. /** Error sending. */
  29. ERROR("Error sending", true),
  30. /** Report queued. */
  31. QUEUED("Queued", false),
  32. /** Waiting state. */
  33. WAITING("Waiting", true);
  34. /** toString value of the item. */
  35. private final String value;
  36. /** Whether this state is terminal. */
  37. private final boolean terminal;
  38. /**
  39. * Instantiates the enum.
  40. *
  41. * @param value toString value
  42. * @param terminal Whether or not the state is terminal (i.e., whether there are pending actions
  43. * to be performed on the error)
  44. */
  45. ErrorReportStatus(final String value, final boolean terminal) {
  46. this.value = value;
  47. this.terminal = terminal;
  48. }
  49. /**
  50. * Determines whether or not this state is terminal. Terminal states are defined as those on
  51. * which no further actions will be performed without user interaction. Non-terminal states may
  52. * start or finish sending in the future.
  53. *
  54. * @return True if the state is terminal, false otherwise
  55. */
  56. public boolean isTerminal() {
  57. return terminal;
  58. }
  59. @Override
  60. public String toString() {
  61. return value;
  62. }
  63. }