1 8 9 package net.sourceforge.chaperon.process.extended; 10 11 import net.sourceforge.chaperon.model.extended.Pattern; 12 13 17 public class GotoAction 18 { 19 public final String symbol; 20 public final Pattern pattern; 21 public final State state; 22 23 public GotoAction(String symbol, State state) 24 { 25 if (symbol==null) 26 throw new IllegalArgumentException ("Symbol is null"); 27 28 if (state==null) 29 throw new IllegalArgumentException ("State is null"); 30 31 this.symbol = symbol; 32 this.pattern = null; 33 this.state = state; 34 } 35 36 public GotoAction(Pattern pattern, State state) 37 { 38 if (pattern==null) 39 throw new IllegalArgumentException ("Pattern is null"); 40 41 if (state==null) 42 throw new IllegalArgumentException ("State is null"); 43 44 this.symbol = null; 45 this.pattern = pattern; 46 this.state = state; 47 } 48 49 public boolean equals(Object o) 50 { 51 if (o instanceof GotoAction) 52 { 53 GotoAction gotoAction = (GotoAction)o; 54 55 if (symbol!=null) 56 return (gotoAction.symbol!=null) && symbol.equals(gotoAction.symbol); 57 58 return (pattern==gotoAction.pattern); 59 } 60 61 return false; 62 } 63 } 64 | Popular Tags |