1 11 package org.eclipse.ui.internal.ide.registry; 12 13 18 19 public class MarkerQueryResult { 20 23 private String [] values; 24 25 28 private int hashCode; 29 30 38 public MarkerQueryResult(String [] markerAttributeValues) { 39 if (markerAttributeValues == null) { 40 throw new IllegalArgumentException (); 41 } 42 values = markerAttributeValues; 43 computeHashCode(); 44 } 45 46 49 public boolean equals(Object o) { 50 if (!(o instanceof MarkerQueryResult)) { 51 return false; 52 } 53 54 if (o == this) { 55 return true; 56 } 57 58 MarkerQueryResult mqr = (MarkerQueryResult) o; 59 if (values.length != mqr.values.length) { 60 return false; 61 } 62 63 for (int i = 0; i < values.length; i++) { 64 if (!(values[i].equals(mqr.values[i]))) { 65 return false; 66 } 67 } 68 69 return true; 70 } 71 72 75 public int hashCode() { 76 return hashCode; 77 } 78 79 82 public void computeHashCode() { 83 hashCode = 19; 84 85 for (int i = 0; i < values.length; i++) { 86 hashCode = hashCode * 37 + values[i].hashCode(); 87 } 88 } 89 } 90 | Popular Tags |