1 31 32 33 package org.antlr.works.visualization.fa; 34 35 import java.util.List ; 36 37 public class FATransition { 38 39 public FAState source; 40 public String label; 41 public FAState target; 42 43 44 public boolean loop = false; 45 46 47 public boolean externalRuleRef = false; 48 49 50 public List <Integer > skippedStates; 51 52 public FATransition(String label, FAState targetState) { 53 this.label = label; 54 this.target = targetState; 55 } 56 57 public FATransition(FAState targetState) { 58 this(targetState, null); 59 } 60 61 public FATransition(FAState targetState, List <Integer > skippedStates) { 62 this.label = null; this.target = targetState; 64 this.skippedStates = skippedStates; 65 } 66 67 public void setSourceState(FAState source) { 68 this.source = source; 69 } 70 71 public void setLoop(boolean loop) { 72 this.loop = loop; 73 } 74 75 public void setExternalRuleRef(boolean flag) { 76 this.externalRuleRef = flag; 77 } 78 79 public boolean isEpsilon() { 80 return label == null; 81 } 82 83 public boolean containsStateNumber(int n) { 84 for (Integer state : skippedStates) { 85 if (state == n) 86 return true; 87 } 88 return false; 89 } 90 } 91 | Popular Tags |