Class NumOrTwoSeqOrNdArr


  • public class NumOrTwoSeqOrNdArr
    extends Either.OfThree<Double,​double[],​double[][]>
    Represents a specialized version of Either.OfThree that can hold one of three types:
    • A Double value
    • An array of two double values
    • A 2D array of double values
    This class enforces specific constraints on the second type, requiring it to be a sequence of exactly two doubles.
    • Constructor Detail

      • NumOrTwoSeqOrNdArr

        protected NumOrTwoSeqOrNdArr​(Double first,
                                     double[] second,
                                     double[][] third,
                                     Either.Selector selector)
        Constructs a NumOrTwoSeqOrNdArr instance with the specified value and selector.
        Parameters:
        first - the Double value, or null if not selected
        second - the array of two double values, or null if not selected
        third - the 2D array of double values, or null if not selected
        selector - the Either.Selector indicating the selected type
    • Method Detail

      • first

        public static NumOrTwoSeqOrNdArr first​(Double first)
        Creates a NumOrTwoSeqOrNdArr instance with the Double value selected.
        Parameters:
        first - the Double value (must not be null)
        Returns:
        a NumOrTwoSeqOrNdArr instance with the Double value selected
        Throws:
        NullPointerException - if first is null
      • second

        public static NumOrTwoSeqOrNdArr second​(double[] second)
        Creates a NumOrTwoSeqOrNdArr instance with the array of two double values selected.
        Parameters:
        second - the array of two double values (must not be null, and must have a length of 2)
        Returns:
        a NumOrTwoSeqOrNdArr instance with the array of two double values selected
        Throws:
        NullPointerException - if second is null
        IllegalArgumentException - if second does not have a length of 2
      • third

        public static NumOrTwoSeqOrNdArr third​(double[][] third)
        Creates a NumOrTwoSeqOrNdArr instance with the 2D array of double values selected.
        Parameters:
        third - the 2D array of double values (must not be null)
        Returns:
        a NumOrTwoSeqOrNdArr instance with the 2D array of double values selected
        Throws:
        NullPointerException - if third is null