01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.l2.context;
06:
07: import com.tc.async.api.EventContext;
08: import com.tc.l2.state.StateManager;
09: import com.tc.util.State;
10:
11: public class StateChangedEvent implements EventContext {
12:
13: private final State from;
14: private final State to;
15:
16: public StateChangedEvent(State from, State to) {
17: this .from = from;
18: this .to = to;
19: }
20:
21: public boolean movedToActive() {
22: return to == StateManager.ACTIVE_COORDINATOR;
23: }
24:
25: public State getCurrentState() {
26: return to;
27: }
28:
29: public State getOldState() {
30: return from;
31: }
32:
33: public String toString() {
34: return "StateChangedEvent [ " + from + " - > " + to + " ]";
35: }
36:
37: }
|