1 7 package ch.ethz.prose.query; 8 9 import java.util.*; 11 import java.io.*; 12 13 19 public 20 class Tuple implements java.io.Serializable { 21 22 23 public Tuple(AspectSurrogate as, CrosscutSurrogate cs, JoinPointRequestSurrogate js) 24 { 25 aspectSurrogate = as; 26 crosscutSurrogate = cs; 27 jpSurrogate = js; 28 } 29 30 public Tuple() 31 { 32 } 34 35 AspectSurrogate aspectSurrogate; 36 CrosscutSurrogate crosscutSurrogate; 37 JoinPointRequestSurrogate jpSurrogate; 38 39 public void setAspectSurrogate(AspectSurrogate as) 40 { aspectSurrogate = as; } 41 42 public void setCrosscutSurrogate(CrosscutSurrogate cs) 43 { crosscutSurrogate = cs; } 44 45 public void setRequestSurrogate(JoinPointRequestSurrogate jprs) 46 { jpSurrogate = jprs; } 47 48 public JoinPointRequestSurrogate getRequestSurrogate() 49 { return jpSurrogate; } 50 51 public AspectSurrogate getAspectSurrogate() 52 { return aspectSurrogate; } 53 54 public CrosscutSurrogate getCrosscutSurrogate() 55 { return crosscutSurrogate; } 56 57 public String toString() 58 { 59 return "(" + aspectSurrogate + "," + crosscutSurrogate + "," + jpSurrogate + ")\n"; 60 } 61 62 72 public 73 boolean equals(Object obj) 74 { 75 if (obj instanceof Tuple) 76 { 77 boolean aspBool=false, croBool=false, joiBool=false; 78 Tuple other = (Tuple)obj; 79 80 if (other.aspectSurrogate == null) 81 aspBool = (this.aspectSurrogate == null); 82 else 83 aspBool = other.aspectSurrogate.equals(this.aspectSurrogate); 84 85 if (aspBool) 86 if (other.crosscutSurrogate == null) 87 croBool = (this.crosscutSurrogate == null); 88 else 89 croBool = other.crosscutSurrogate.equals(this.crosscutSurrogate); 90 91 if (croBool) 92 if (other.jpSurrogate == null) 93 joiBool = (this.jpSurrogate == null); 94 else 95 joiBool = other.jpSurrogate.equals(this.jpSurrogate); 96 97 return (aspBool && croBool && joiBool); 98 } 99 else return false; 100 } 101 102 106 public 107 int hashCode() 108 { 109 int retVal = 0; 110 if (jpSurrogate != null) 111 retVal += jpSurrogate.hashCode(); 112 if (aspectSurrogate != null) 113 retVal += aspectSurrogate.hashCode(); 114 if (crosscutSurrogate != null) 115 retVal += crosscutSurrogate.hashCode(); 116 return retVal; 117 } 118 119 120 121 } 122 123 124 | Popular Tags |