1 7 8 package com.sun.corba.se.spi.orbutil.fsm; 9 10 14 public interface Guard 15 { 16 public static final class Complement extends GuardBase { 17 private Guard guard ; 18 19 public Complement( GuardBase guard ) 20 { 21 super( "not(" + guard.getName() + ")" ) ; 22 this.guard = guard ; 23 } 24 25 public Result evaluate( FSM fsm, Input in ) 26 { 27 return guard.evaluate( fsm, in ).complement() ; 28 } 29 } 30 31 public static final class Result { 32 private String name ; 33 34 private Result( String name ) 35 { 36 this.name = name ; 37 } 38 39 public static Result convert( boolean res ) 40 { 41 return res ? ENABLED : DISABLED ; 42 } 43 44 public Result complement() 45 { 46 if (this == ENABLED) 47 return DISABLED ; 48 else if (this == DISABLED) 49 return ENABLED ; 50 else 51 return DEFERED ; 52 } 53 54 public String toString() 55 { 56 return "Guard.Result[" + name + "]" ; 57 } 58 59 public static final Result ENABLED = new Result( "ENABLED" ) ; 60 public static final Result DISABLED = new Result( "DISABLED" ) ; 61 public static final Result DEFERED = new Result( "DEFERED" ) ; 62 } 63 64 81 public Result evaluate( FSM fsm, Input in ) ; 82 } 83 84 86 87 | Popular Tags |