1 43 package org.exolab.jms.service; 44 45 46 55 public final class ServiceState { 56 57 60 public static final ServiceState STOPPED = new ServiceState("stopped"); 61 public static final ServiceState RUNNING = new ServiceState("running"); 62 63 private static int _upperSentinel = 0; 64 65 68 private String _state; 69 70 73 private int _ord; 74 75 81 private ServiceState(String state) { 82 _state = state; 83 _ord = _upperSentinel++; 84 } 85 86 91 public int getOrd() { 92 return _ord; 93 } 94 95 100 public String toString() { 101 return _state; 102 } 103 104 109 public static int size() { 110 return _upperSentinel; 111 } 112 113 120 public boolean equals(Object object) { 121 boolean equal = (object == this); 122 if (!equal && object instanceof ServiceState) { 123 equal = (_ord == ((ServiceState) object)._ord); 124 } 125 126 return equal; 127 } 128 129 135 public boolean isRunning() { 136 return getOrd() == RUNNING.getOrd(); 137 } 138 139 145 public boolean isStopped() { 146 return getOrd() == STOPPED.getOrd(); 147 } 148 149 } 150 | Popular Tags |