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