1 23 24 package org.objectweb.jorm.api; 25 26 31 public class PStateGraph { 32 41 public static byte nextStatePBinding(byte currentstate, byte action) { 42 switch (currentstate) { 43 case PBinding.LIFECYCLE_ACTIVEFORIO: 44 switch (action) { 45 case PBinding.ACTION_WRITE: 46 case PBinding.ACTION_READ: 47 case PBinding.ACTION_EXIST: 48 case PBinding.ACTION_BIND: 49 return currentstate; 50 case PBinding.ACTION_EXPORT: 51 return PBinding.LIFECYCLE_NEWTOWRITE; 52 case PBinding.ACTION_UNBIND: 53 return PBinding.LIFECYCLE_NOTBOUND; 54 case PBinding.ACTION_UNEXPORT: 55 return PBinding.LIFECYCLE_DELTOWRITE; 56 default : 57 return PBinding.LIFECYCLE_ERROR; 58 } 59 case PBinding.LIFECYCLE_NEWTOWRITE: 60 switch (action) { 61 case PBinding.ACTION_WRITE: 62 case PBinding.ACTION_BIND: 63 return PBinding.LIFECYCLE_ACTIVEFORIO; 64 case PBinding.ACTION_EXPORT: 65 return currentstate; 66 case PBinding.ACTION_UNBIND: 67 case PBinding.ACTION_UNEXPORT: 68 return PBinding.LIFECYCLE_NOTBOUND; 69 case PBinding.ACTION_READ: 70 case PBinding.ACTION_EXIST: 71 return PBinding.LIFECYCLE_NEWTOWRITE; 72 default : 73 return PBinding.LIFECYCLE_ERROR; 74 } 75 case PBinding.LIFECYCLE_DELTOWRITE: 76 switch (action) { 77 case PBinding.ACTION_WRITE: 78 case PBinding.ACTION_UNBIND: 79 return PBinding.LIFECYCLE_NOTBOUND; 80 case PBinding.ACTION_BIND: 81 return PBinding.LIFECYCLE_ACTIVEFORIO; 82 case PBinding.ACTION_EXPORT: 83 return PBinding.LIFECYCLE_NEWTOWRITE; 84 case PBinding.ACTION_UNEXPORT: 85 return currentstate; 86 case PBinding.ACTION_READ: 87 case PBinding.ACTION_EXIST: 88 default : 89 return PBinding.LIFECYCLE_ERROR; 90 } 91 case PBinding.LIFECYCLE_NOTBOUND: 92 switch (action) { 93 case PBinding.ACTION_BIND: 94 return PBinding.LIFECYCLE_ACTIVEFORIO; 95 case PBinding.ACTION_EXPORT: 96 return PBinding.LIFECYCLE_NEWTOWRITE; 97 case PBinding.ACTION_UNBIND: 98 return currentstate; 99 case PBinding.ACTION_WRITE: 100 case PBinding.ACTION_READ: 101 case PBinding.ACTION_EXIST: 102 case PBinding.ACTION_UNEXPORT: 103 default : 104 return PBinding.LIFECYCLE_ERROR; 105 } 106 default : 107 return PBinding.LIFECYCLE_ERROR; 108 } 109 } 110 } 111 | Popular Tags |