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 | package Torello.Java.Additional;
/**
* This simple generic-class allows a function to return <B STYLE='color:red'>six</B> objects as a
* result, instead of just one. This is not always so useful, and can make code confusing.
* However there are some instances where the only alternative would be to create an entirely new
* class/object, when only a single method result would use that object.
*
* <BR /><BR /><B CLASS=JDDescLabel>Field Name Change:</B>
*
* <BR />For the classes {@code Ret6}, {@link Ret7} & {@link Ret8} - 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=Ret DATA-N=6>
* <EMBED CLASS='external-html' DATA-FILE-ID=IMMUTABLE_RET>
* @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 Ret6<A1, B2, C3, D4, E5, F6>
extends RetN
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 response object. */
public final A1 a1;
/** This holds a pointer to the second response object. */
public final B2 b2;
/** This holds a pointer to the third response object. */
public final C3 c3;
/** This holds a pointer to the fourth response object. */
public final D4 d4;
/** This holds a pointer to the fifth response object. */
public final E5 e5;
/** This holds a pointer to the sixth response object. */
public final F6 f6;
/** Constructs this object */
public Ret6(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;
}
/**
* Returns {@code '6'}, indicating how many fields are declared by this class.
* @return As an instance of {@code Ret6}, 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 Ret6<A1, B2, C3, D4, E5, F6> clone()
{ return new Ret6<>(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 Tuple6<A1, B2, C3, D4, E5, F6> toModifiable()
{ return new Tuple6<>(this.a1, this.b2, this.c3, this.d4, this.e5, this.f6); }
}
|