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
package Torello.Java.Additional;

import java.lang.reflect.Field;
import Torello.Java.UnreachableError;

/**
 * This is a parent class of the Tuple classes. ({@code Tuple0 ... Tuple8})
 * All classes which inherit {@code TupleN} have Read/Write, non-final, fields.
 */
public abstract class TupleN extends MultiType
{
    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID>  */
    protected static final long serialVersionUID = 1;

    TupleN() { }
        // Cannot be private, because of the 'abstract' modifier
        // Cannot be public (the auto-generated, zero-arg constructor is always public)
        //      because then it makes my JavaDoc ugly

    // Since the "RetN" asArray is an array of constant/final fieldd, that array only needs to be
    // instantiated once.  That array is cached inside of a transient Array-Field in RetN.
    // Here, since these field are Read/Write, Mutable, the array would have to be created every 
    // time.

    final Object[] asArrayMain() { return asArrayInternal(); }

    /**
     * Converts {@code 'this'} Modifiable {@code TupleN} instance into a Read-Only {@link RetN}.
     * 
     * @return A {@link RetN} of the same size, which is an immutable type whose fields have been 
     * decorated with the {@code 'final'} modifier - <I>and therefore cannot be changed once the 
     * instance has been constructed</I>.
     */
    public abstract RetN toImmutable();
}