idCounterElem.java 446 B

123456789101112131415161718192021222324252627282930
  1. package ui.model;
  2. public class idCounterElem {
  3. private static int counter = 1;
  4. public static synchronized int nextId() {
  5. return counter++;
  6. }
  7. /**
  8. * @return the counter
  9. */
  10. public static int getCounter() {
  11. return counter;
  12. }
  13. /**
  14. * @param counter
  15. * the counter to set
  16. */
  17. public static void setCounter(int counter) {
  18. idCounterElem.counter = counter;
  19. }
  20. public static void resetCounter() {
  21. counter = 1;
  22. }
  23. }