KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > l2 > context > StateChangedEvent


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.l2.context;
6
7 import com.tc.async.api.EventContext;
8 import com.tc.l2.state.StateManager;
9 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 JavaDoc toString() {
34     return "StateChangedEvent [ " + from + " - > " + to + " ]";
35   }
36
37 }
38
Popular Tags