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