001package Torello.Java.Additional; 002 003import java.lang.reflect.Field; 004import Torello.Java.UnreachableError; 005 006/** 007 * This is a parent class of the Tuple classes. ({@code Tuple0 ... Tuple8}) 008 * All classes which inherit {@code TupleN} have Read/Write, non-final, fields. 009 */ 010public abstract class TupleN extends MultiType 011{ 012 /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */ 013 protected static final long serialVersionUID = 1; 014 015 TupleN() { } 016 // Cannot be private, because of the 'abstract' modifier 017 // Cannot be public (the auto-generated, zero-arg constructor is always public) 018 // because then it makes my JavaDoc ugly 019 020 // Since the "RetN" asArray is an array of constant/final fieldd, that array only needs to be 021 // instantiated once. That array is cached inside of a transient Array-Field in RetN. 022 // Here, since these field are Read/Write, Mutable, the array would have to be created every 023 // time. 024 025 final Object[] asArrayMain() { return asArrayInternal(); } 026 027 /** 028 * Converts {@code 'this'} Modifiable {@code TupleN} instance into a Read-Only {@link RetN}. 029 * 030 * @return A {@link RetN} of the same size, which is an immutable type whose fields have been 031 * decorated with the {@code 'final'} modifier - <I>and therefore cannot be changed once the 032 * instance has been constructed</I>. 033 */ 034 public abstract RetN toImmutable(); 035}