1 8 9 package net.sourceforge.chaperon.process.extended; 10 11 import net.sourceforge.chaperon.model.extended.Pattern; 12 13 17 public class LookaheadReduceAction extends ReduceAction 18 { 19 public final char minimum; 20 public final char maximum; 21 22 public LookaheadReduceAction(char minimum, char maximum, String symbol, int length) 23 { 24 super(symbol, length); 25 26 this.minimum = minimum; 27 this.maximum = maximum; 28 } 29 30 public LookaheadReduceAction(char minimum, char maximum, Pattern pattern, int length) 31 { 32 super(pattern, length); 33 34 this.minimum = minimum; 35 this.maximum = maximum; 36 } 37 38 public boolean contains(char c) 39 { 40 return (minimum<=c) && (c<=maximum); 41 } 42 43 public boolean equals(Object o) 44 { 45 if (o instanceof LookaheadReduceAction) 46 { 47 LookaheadReduceAction reduceAction = (LookaheadReduceAction)o; 48 49 if (symbol!=null) 50 return (minimum==reduceAction.minimum) && (maximum==reduceAction.maximum) && 51 (symbol.equals(reduceAction.symbol)) && (length==reduceAction.length); 52 53 return (minimum==reduceAction.minimum) && (maximum==reduceAction.maximum) && 54 (pattern==reduceAction.pattern) && (length==reduceAction.length); 55 } 56 57 return false; 58 } 59 } 60 | Popular Tags |