001package Torello.Java.Additional;
002
003/**
004 * This simple generic-class allows a function to return <B STYLE='color:red'>six</B> objects as a
005 * result, instead of just one.   This is not always so useful, and can make code confusing.
006 * However there are some instances where the only alternative would be to create an entirely new
007 * class/object, when only a single method result would use that object.
008 *
009 * <BR /><BR /><B>ALSO: </B> For the classes Ret6, Ret7 &amp; Ret8 - the variable name includes a
010 * number as well, since the letters become progressively more difficult to look at as they
011 * increase past "A, B, C, D..."
012 * 
013 * @param <A1> The type of the <B STYLE='color:red'>first</B> member-field ({@code 'a1'}).
014 * @param <B2> The type of the <B STYLE='color:red'>second</B> member-field ({@code 'b2'}).
015 * @param <C3> The type of the <B STYLE='color:red'>third</B> member-field ({@code 'c3'}).
016 * @param <D4> The type of the <B STYLE='color:red'>fourth</B> member-field ({@code 'd4'}).
017 * @param <E5> The type of the <B STYLE='color:red'>fifth</B> member-field ({@code 'e5'}).
018 * @param <F6> The type of the <B STYLE='color:red'>last</B> member-field ({@code 'f6'}).
019 */
020public class Ret6<A1, B2, C3, D4, E5, F6>
021    extends RetN
022    implements java.io.Serializable, Cloneable
023{
024    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID>  */
025    protected static final long serialVersionUID = 1;
026
027    /** This holds a pointer the first response object. */
028    public final A1 a1;
029
030    /** This holds a pointer to the second response object. */
031    public final B2 b2;
032
033    /** This holds a pointer to the third response object. */
034    public final C3 c3;
035
036    /** This holds a pointer to the fourth response object. */
037    public final D4 d4;
038
039    /** This holds a pointer to the fifth response object. */
040    public final E5 e5;
041
042    /** This holds a pointer to the sixth response object. */
043    public final F6 f6;
044
045    /** Constructs this object */
046    public Ret6(A1 a1, B2 b2, C3 c3, D4 d4, E5 e5, F6 f6)
047    {
048        this.a1 = a1;
049        this.b2 = b2;
050        this.c3 = c3;
051
052        this.d4 = d4;
053        this.e5 = e5;
054        this.f6 = f6;
055    }
056
057    /**
058     * Returns {@code '6'}, indicating how many fields are declared by this class.
059     * 
060     * @return As in instance of {@code Ret6}, this method returns {@code '6'};
061     */
062    public int n() { return 6; }
063
064    // Super-class uses this for toString, equals, and hashCode
065    // There is an optimization, so if this is requested multiple times, it is saved in a
066    // transient field.
067    final Object[] asArrayInternal()
068    { return new Object[] { a1, b2, c3, d4, e5, f6 }; }
069
070    /**
071     * Fulfills Java's {@code interface Cloneable} requirements.
072     * 
073     * @return A copy of {@code 'this'} instance of {@code Ret6}.
074     */
075    public Ret6<A1, B2, C3, D4, E5, F6> clone()
076    { return new Ret6<>(this.a1, this.b2, this.c3, this.d4, this.e5, this.f6); }
077
078}