Class Tuple7<A1,​B2,​C3,​D4,​E5,​F6,​G7>

  • Type Parameters:
    A1 - The type of the first member-field ('a1').
    B2 - The type of the second member-field ('b2').
    C3 - The type of the third member-field ('c3').
    D4 - The type of the fourth member-field ('d4').
    E5 - The type of the fifth member-field ('e5').
    F6 - The type of the sixth member-field ('f6').
    G7 - The type of the last member-field ('g7').
    All Implemented Interfaces:, java.lang.Cloneable

    public class Tuple7<A1,​B2,​C3,​D4,​E5,​F6,​G7>
    extends TupleN
    implements, java.lang.Cloneable
    This simple generic-class allows for storing seven objects with a single reference.

    Field Name Change:
    For the classes Tuple6, Tuple7 & Tuple8 - the field names include a number as well (see a1, b2, 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 - 'a', 'b', 'c', 'd' and 'e'.

    Modifiable, Read-Write
    Classes which inherit Ancestor-Class TupleN will always contains fields which are not declared using the 'final' modifier. These classes are, therefore, "Mutable Tuples" - meaning their contents may be changed whenever necessary.

    Remember: The classes Ret7 and Tuple7 completely identical, with the sole difference being that Ret7 fields are all declared final, but the Tuple7 fields are not!
    See Also:
    Serialized Form

    • Constructor Summary

      Constructor Description
      Constructs this object.
      Tuple7​(A1 a1, B2 b2, C3 c3, D4 d4, E5 e5, F6 f6, G7 g7)
      Constructs this object
    • Method Summary

      Retrieve the Number of Fields in this Class
      Modifier and Type Method
      int n()
      Retrieve a Field by Field-Number
      Modifier and Type Method
      Object get​(int i)
      Convert this instance to an Immutable RetN instance, of the same size
      Modifier and Type Method
      Ret7<A1,​B2,​C3,​D4,​E5,​F6,​G7> toImmutable()
      Methods: interface java.lang.Cloneable
      Modifier and Type Method
      Tuple7<A1,​B2,​C3,​D4,​E5,​F6,​G7> clone()
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • n

        🡅  🡇     🗕  🗗  🗖
        public int n()
        Returns '7', indicating how many fields are declared by this class.
        Specified by:
        n in class MultiType
        As an instance of Tuple7, this method returns '7';
        Exact Method Body:
         return 7;
      • clone

        🡅  🡇     🗕  🗗  🗖
        public Tuple7<A1,​B2,​C3,​D4,​E5,​F6,​G7clone()
        Description copied from class: MultiType
        Clones the contents of 'this' instance of.
        Specified by:
        clone in class MultiType
        A clone copy of 'this' object.
        Exact Method Body:
         return new Tuple7<>(this.a1, this.b2, this.c3, this.d4, this.e5, this.f6, this.g7);
      • get

        🡅  🡇     🗕  🗗  🗖
        public java.lang.Object get​(int i)
        This method will retreive the ith field of this instance. This can be useful when you wish to use the Ancestor / Parent classses: TupleN or MultiType for handling 'this' instance.

        As a reminder, the fields inside this class have all been declared public! Referencing this instance' fields, directly, will always work in place of calling any of the get(...) methods.

        Type Casting:
        This method can make for easier typing. When using either of the super-classes of this class - namely TupleN or MultiType - you simply do not have to type (into your computer's keyboard) all of the Field Generic Types (the stuff between the '<' and '>' less-than & greater-than symbols).

        However, anytime one of these ancestor classes are used instead of the actual Tuple7 instance, you will have to use one of the provided 'get' methods to retrieve a field inside the Tuple7 instance. This is because the parent-ancestor classes do not actually have any fields to retrieve.

        There are three 'get' methods provided in Root-Ancestor Class MultiType. Each of these three 'getters' allows for casting (this) sub-class' returned fields in a slightly different way. When you aren't referencing the actual instance, itself, but rather one of the two Parent-Tuple Classes, you must use one of their getters, and you will have to cast the fields that you wish to use, eventually!

        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // No Cast Necessary
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // This line makes for longer typing, but DOES NOT REQUIRE A CAST TO RETRIEVE FIELDS.
        // Here the example Multi-Type Identifier is used: Tuple7.
        Tuple7<String, Integer, Date, File, DotPair, HTMLNode, TagNode> ref7 =
        String neededStrField = ref7.a1;
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // Less Keyboard-Typing (Less Eyesores), but Requires a Cast
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // If the Tuple7 super-class TupleN is used to reference this class data,
        TupleN refN = some_function_returns7();
        // Version #1: (this method) - simple 'get'
        String neededStrField = (String) refN.get(1);
        // Version #2: The second Method-Parameter is a 'Class<T>' Type-Parameter
        // Note, again, that passing a '1' to the first parameter retrieves Tuple7.a1
        String neededStrField = refN.get(1, String.class);
        // Version #3: "GET" (in all caps) utilizes Java "Type-Inferencing" - the Return-Type
        // is specified by the left side of the assignments statement.
        String needesStrField = refN.GET(1);
        Specified by:
        get in class MultiType
        i - This specifies which field of the instance is being requested.

        IMPORTANT: Unlike a Java array, when a '1' is passed to this parameter, it is requesting the first field in this instance. Passing a value of '0' shall cause an IndexOutOfBoundsException throw.
        This returns the ith field of this class.
        See Also:
        MultiType.get(int, Class), MultiType.GET(int)
        Exact Method Body:
         // Throws Exception if i not in [1..7]
         if (i <= 4) switch (i)
             case 1:     return a1;
             case 2:     return b2;
             case 3:     return c3;
             default:    return d4;
         else switch (i)
             case 5:     return e5;
             case 6:     return f6;
             default:    return g7;
      • toImmutable

        🡅     🗕  🗗  🗖
        public Ret7<A1,​B2,​C3,​D4,​E5,​F6,​G7toImmutable()
        Description copied from class: TupleN
        Converts 'this' Modifiable TupleN instance into a Read-Only RetN.
        Specified by:
        toImmutable in class TupleN
        A RetN of the same size, which is an immutable type whose fields have been decorated with the 'final' modifier - and therefore cannot be changed once the instance has been constructed.
        Exact Method Body:
         return new Ret7<>(this.a1, this.b2, this.c3, this.d4, this.e5, this.f6, this.g7);