KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > Tuple5


1 package jfun.parsec;
2
3 import jfun.util.Misc;
4
5 /**
6  * This is a simple Java Bean for 5 objects.
7  * <p>
8  * @author Ben Yu
9  * Apr 24, 2006 1:45:42 PM
10  * @param <A>
11  * @param <B>
12  * @param <C>
13  * @param <D>
14  * @param <E>
15  * @since version 1.1
16  */

17 public class Tuple5<A, B, C, D, E> extends Tuple4<A,B,C,D>{
18   private E value5;
19   public Tuple5(A value1, B value2, C value3, D value4, E value5) {
20     super(value1, value2, value3, value4);
21     this.value5 = value5;
22   }
23   public Tuple5() {
24   }
25   public E getValue5() {
26     return value5;
27   }
28   public void setValue5(E value5) {
29     this.value5 = value5;
30   }
31   public boolean equals(Tuple5 other){
32     return super.equals(other) && Misc.equals(value5, other.value5);
33   }
34   @Override JavaDoc
35   public boolean equals(Object JavaDoc obj) {
36     if(obj instanceof Tuple5){
37       return equals((Tuple5)obj);
38     }
39     else return false;
40   }
41   @Override JavaDoc
42   public int hashCode() {
43     return super.hashCode()*31+Misc.hashcode(value5);
44   }
45   @Override JavaDoc
46   public String JavaDoc toString() {
47     return "("+getValue1()+","+getValue2()
48     +","+getValue3()+","+getValue4()+","+getValue5()+")";
49   }
50 }
51
Popular Tags