1 package jfun.parsec; 2 3 import jfun.util.Misc; 4 5 15 public class Tuple3<A, B, C> extends Pair<A,B> { 16 private C value3; 17 public Tuple3(){} 18 public Tuple3(A value1, B value2, C value3) { 19 super(value1, value2); 20 this.value3 = value3; 21 } 22 public C getValue3() { 23 return value3; 24 } 25 public void setValue3(C value3) { 26 this.value3 = value3; 27 } 28 public boolean equals(Tuple3 other){ 29 return super.equals(other) && Misc.equals(value3, other.value3); 30 } 31 @Override 32 public boolean equals(Object obj) { 33 if(obj instanceof Tuple3){ 34 return equals((Tuple3)obj); 35 } 36 else return false; 37 } 38 @Override 39 public int hashCode() { 40 return super.hashCode()*31+Misc.hashcode(value3); 41 } 42 @Override 43 public String toString() { 44 return "("+getValue1()+","+getValue2()+","+getValue3()+")"; 45 } 46 } 47 | Popular Tags |