KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > orbutil > fsm > GuardedAction


1 /*
2  * @(#)GuardedAction.java 1.7 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.orbutil.fsm ;
9
10 import com.sun.corba.se.spi.orbutil.fsm.Guard ;
11 import com.sun.corba.se.spi.orbutil.fsm.GuardBase ;
12 import com.sun.corba.se.spi.orbutil.fsm.Input ;
13 import com.sun.corba.se.spi.orbutil.fsm.Action ;
14 import com.sun.corba.se.spi.orbutil.fsm.State ;
15 import com.sun.corba.se.spi.orbutil.fsm.FSM ;
16
17 public class GuardedAction {
18     private static Guard trueGuard = new GuardBase( "true" ) {
19     public Guard.Result evaluate( FSM fsm, Input in )
20     {
21         return Guard.Result.ENABLED ;
22     }
23     } ;
24
25     private Guard guard ;
26     private Action action ;
27     private State nextState ;
28
29     public GuardedAction( Action action, State nextState )
30     {
31     this.guard = trueGuard ;
32     this.action = action ;
33     this.nextState = nextState ;
34     }
35
36     public GuardedAction( Guard guard, Action action, State nextState )
37     {
38     this.guard = guard ;
39     this.action = action ;
40     this.nextState = nextState ;
41     }
42
43     public String JavaDoc toString()
44     {
45     return "GuardedAction[action=" + action + " guard=" + guard +
46         " nextState=" + nextState + "]" ;
47     }
48
49     public Action getAction() { return action ; }
50     public Guard getGuard() { return guard ; }
51     public State getNextState() { return nextState ; }
52 }
53
54
Popular Tags