1 2 package com.sun.java_cup.internal; 3 4 11 public class reduce_action extends parse_action { 12 13 14 15 16 17 20 public reduce_action(production prod ) throws internal_error 21 { 22 23 if (prod == null) 24 throw new internal_error( 25 "Attempt to create a reduce_action with a null production"); 26 27 _reduce_with = prod; 28 } 29 30 31 32 33 34 35 protected production _reduce_with; 36 37 38 public production reduce_with() {return _reduce_with;} 39 40 41 42 43 44 45 public int kind() {return REDUCE;} 46 47 48 49 50 public boolean equals(reduce_action other) 51 { 52 return other != null && other.reduce_with() == reduce_with(); 53 } 54 55 56 57 58 public boolean equals(Object other) 59 { 60 if (other instanceof reduce_action) 61 return equals((reduce_action)other); 62 else 63 return false; 64 } 65 66 67 68 69 public int hashCode() 70 { 71 72 return reduce_with().hashCode(); 73 } 74 75 76 77 public String toString() 78 { 79 return "REDUCE(with prod " + reduce_with().index() + ")"; 80 } 81 82 83 84 } 85 | Popular Tags |