1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package Torello.Java.Additional;

import java.lang.reflect.Field;

/**
 * This simple generic-class allows for storing <B STYLE='color:red'>six</B> objects with a 
 * single reference.
 *
 * <BR /><BR /><B CLASS=JDDescLabel>Field Name Change:</B>
 * 
 * <BR />For the classes {@code Tuple6}, {@link Tuple7} &amp; {@link Tuple8} - the field names
 * include a number as well (see {@link #a1}, {@link #b2}, {@link #c3} etc...).  This is simply due
 * to the fact that these Field-Names become progressively more difficult to read or even look at
 * after the first four or five letters - {@code 'a', 'b', 'c', 'd'} and {@code 'e'}.
 * 
 * <EMBED CLASS=globalDefs DATA-KIND=Tuple DATA-N=6>
 * <EMBED CLASS='external-html' DATA-FILE-ID=MUTABLE_TUPLE>
 * @param <A1> The type of the <B STYLE='color:red'>first</B> member-field ('{@link #a1}').
 * @param <B2> The type of the <B STYLE='color:red'>second</B> member-field ('{@link #b2}').
 * @param <C3> The type of the <B STYLE='color:red'>third</B> member-field ('{@link #c3}').
 * @param <D4> The type of the <B STYLE='color:red'>fourth</B> member-field ('{@link #d4}').
 * @param <E5> The type of the <B STYLE='color:red'>fifth</B> member-field ('{@link #e5}').
 * @param <F6> The type of the <B STYLE='color:red'>last</B> member-field ('{@link #f6}').
 */
public class Tuple6<A1, B2, C3, D4, E5, F6>
    extends TupleN
    implements java.io.Serializable, Cloneable
{
    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID>  */
    protected static final long serialVersionUID = 1;

    /** This holds a pointer the first field / instance. */
    public A1 a1;

    /** This holds a pointer to the second field / instance. */
    public B2 b2;

    /** This holds a pointer to the third field / instance. */
    public C3 c3;

    /** This holds a pointer to the fourth field / instance. */
    public D4 d4;

    /** This holds a pointer to the fifth field / instance. */
    public E5 e5;

    /** This holds a pointer to the sixth field / instance. */
    public F6 f6;

    /** Constructs this object */
    public Tuple6(A1 a1, B2 b2, C3 c3, D4 d4, E5 e5, F6 f6)
    {
        this.a1 = a1;
        this.b2 = b2;
        this.c3 = c3;

        this.d4 = d4;
        this.e5 = e5;
        this.f6 = f6;
    }

    /** Constructs this object.  Initializes all fields top null. */
    public Tuple6()
    {
        this.a1 = null;
        this.b2 = null;
        this.c3 = null;

        this.d4 = null;
        this.e5 = null;
        this.f6 = null;
    }

    /**
     * Returns {@code '6'}, indicating how many fields are declared by this class.
     * @return As an instance of {@code Tuple6}, this method returns {@code '6'};
     */
    public int n() { return 6; }

    // Super-class uses this for toString, equals, and hashCode
    // There is an optimization, so if this is requested multiple times, it is saved in a
    // transient field.

    final Object[] asArrayInternal()
    { return new Object[] { a1, b2, c3, d4, e5, f6 }; }

    public Tuple6<A1, B2, C3, D4, E5, F6> clone()
    { return new Tuple6<>(this.a1, this.b2, this.c3, this.d4, this.e5, this.f6); }

    /**
     * <EMBED CLASS=defs DATA-TEXT="">
     * <EMBED CLASS='external-html' DATA-FILE-ID=MULTI_TYPE_EX_COMMON>
     * <EMBED CLASS='external-html' DATA-FILE-ID=MULTI_TYPE_GET_EX_6_8>
     */
    public Object get(final int i)
    {
        // Throws Exception if i not in [1..6]
        CHECK_GET(i);

        if (i <= 3) switch (i)
        {
            case 1:     return a1;
            case 2:     return b2;
            default:    return c3;
        }

        else switch (i)
        {
            case 4:     return d4;
            case 5:     return e5;
            default:    return f6;
        }
    }

    public Ret6<A1, B2, C3, D4, E5, F6> toImmutable()
    { return new Ret6<>(this.a1, this.b2, this.c3, this.d4, this.e5, this.f6); }
}