1 2 21 package gov.nasa.ltl.trans; 23 24 import gov.nasa.ltl.graph.*; 25 26 29 public class Translator { 30 public static final int LTL2AUT = 0; 31 public static final int LTL2BUCHI = 1; 32 private static int algorithm = LTL2BUCHI; 34 public static int get_algorithm () { 35 return algorithm; 36 } 37 38 public static boolean set_algorithm (int alg) { 39 if ((alg == LTL2AUT) || (alg == LTL2BUCHI)) { 41 algorithm = alg; 42 43 return true; 44 } else { 45 return false; 46 } 47 } 48 49 public static Graph translate (String formula) { 50 try { 51 Formula ltl = Formula.parse(formula); 52 Node init = Node.createInitial(ltl); 53 State[] states = (init.expand(new Automaton())).structForRuntAnalysis(); 54 return Automaton.SMoutput(states); 55 } catch (ParseErrorException e) { 56 throw new LTLErrorException("parse error: " + e.getMessage()); 57 } 58 } 59 } | Popular Tags |