00001 package edu.tum.cs.ias.knowrob.vis.actions; 00002 00003 public enum FsmActionResult { 00004 00008 OK, 00012 CONDITION_TRUE, 00016 CONDITION_FALSE, 00020 ERROR, 00024 ABORT, 00028 OUT_OF_RESOURCES, 00032 TIMEOUT; 00033 00034 00035 public static FsmActionResult fromString(String status) { 00036 00037 if(status.endsWith("OK")) { 00038 return FsmActionResult.OK; 00039 00040 } else if(status.endsWith("CONDITION_TRUE")) { 00041 return FsmActionResult.CONDITION_TRUE; 00042 00043 } else if(status.endsWith("CONDITION_FALSE")) { 00044 return FsmActionResult.CONDITION_FALSE; 00045 00046 } else if(status.endsWith("TIMEOUT")) { 00047 return FsmActionResult.TIMEOUT; 00048 00049 } else if(status.endsWith("OUT_OF_RESOURCES")) { 00050 return FsmActionResult.OUT_OF_RESOURCES; 00051 00052 } else if(status.endsWith("ABORT")) { 00053 return FsmActionResult.ABORT; 00054 00055 } else { 00056 return FsmActionResult.ERROR; 00057 } 00058 } 00059 00060 public static String toOWLIdentifier(FsmActionResult r) { 00061 00062 String res = r.toString(); 00063 00064 if(!res.startsWith("CONDITION")) 00065 res = "COMPLETED_" + res; 00066 00067 return "http://ias.cs.tum.edu/kb/knowrob.owl#" + res; 00068 } 00069 00070 } 00071