Package com.fa993.types.supertype
Class NumOrTwoSeqOrNdArr
- java.lang.Object
-
- com.fa993.types.supertype.Either.OfThree<Double,double[],double[][]>
-
- com.fa993.types.supertype.NumOrTwoSeqOrNdArr
-
public class NumOrTwoSeqOrNdArr extends Either.OfThree<Double,double[],double[][]>
Represents a specialized version ofEither.OfThree
that can hold one of three types:- A
Double
value - An array of two
double
values - A 2D array of
double
values
- A
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NumOrTwoSeqOrNdArr(Double first, double[] second, double[][] third, Either.Selector selector)
Constructs aNumOrTwoSeqOrNdArr
instance with the specified value and selector.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NumOrTwoSeqOrNdArr
first(Double first)
Creates aNumOrTwoSeqOrNdArr
instance with theDouble
value selected.static NumOrTwoSeqOrNdArr
second(double[] second)
Creates aNumOrTwoSeqOrNdArr
instance with the array of twodouble
values selected.static NumOrTwoSeqOrNdArr
third(double[][] third)
Creates aNumOrTwoSeqOrNdArr
instance with the 2D array ofdouble
values selected.-
Methods inherited from class com.fa993.types.supertype.Either.OfThree
first, getFirst, getSecond, getSelector, getThird, second, third
-
-
-
-
Constructor Detail
-
NumOrTwoSeqOrNdArr
protected NumOrTwoSeqOrNdArr(Double first, double[] second, double[][] third, Either.Selector selector)
Constructs aNumOrTwoSeqOrNdArr
instance with the specified value and selector.- Parameters:
first
- theDouble
value, ornull
if not selectedsecond
- the array of twodouble
values, ornull
if not selectedthird
- the 2D array ofdouble
values, ornull
if not selectedselector
- theEither.Selector
indicating the selected type
-
-
Method Detail
-
first
public static NumOrTwoSeqOrNdArr first(Double first)
Creates aNumOrTwoSeqOrNdArr
instance with theDouble
value selected.- Parameters:
first
- theDouble
value (must not benull
)- Returns:
- a
NumOrTwoSeqOrNdArr
instance with theDouble
value selected - Throws:
NullPointerException
- iffirst
isnull
-
second
public static NumOrTwoSeqOrNdArr second(double[] second)
Creates aNumOrTwoSeqOrNdArr
instance with the array of twodouble
values selected.- Parameters:
second
- the array of twodouble
values (must not benull
, and must have a length of 2)- Returns:
- a
NumOrTwoSeqOrNdArr
instance with the array of twodouble
values selected - Throws:
NullPointerException
- ifsecond
isnull
IllegalArgumentException
- ifsecond
does not have a length of 2
-
third
public static NumOrTwoSeqOrNdArr third(double[][] third)
Creates aNumOrTwoSeqOrNdArr
instance with the 2D array ofdouble
values selected.- Parameters:
third
- the 2D array ofdouble
values (must not benull
)- Returns:
- a
NumOrTwoSeqOrNdArr
instance with the 2D array ofdouble
values selected - Throws:
NullPointerException
- ifthird
isnull
-
-