1619
1620 /**
1621 * Finds a species for an element type of {@code double} and shape.
1622 *
1623 * @param s the shape
1624 * @param <S> the type of shape
1625 * @return a species for an element type of {@code double} and shape
1626 * @throws IllegalArgumentException if no such species exists for the shape
1627 */
1628 @SuppressWarnings("unchecked")
1629 public static <S extends Shape> DoubleSpecies<S> species(S s) {
1630 Objects.requireNonNull(s);
1631 if (s == Shapes.S_64_BIT) {
1632 return (DoubleSpecies<S>) Double64Vector.SPECIES;
1633 } else if (s == Shapes.S_128_BIT) {
1634 return (DoubleSpecies<S>) Double128Vector.SPECIES;
1635 } else if (s == Shapes.S_256_BIT) {
1636 return (DoubleSpecies<S>) Double256Vector.SPECIES;
1637 } else if (s == Shapes.S_512_BIT) {
1638 return (DoubleSpecies<S>) Double512Vector.SPECIES;
1639 } else {
1640 throw new IllegalArgumentException("Bad shape: " + s);
1641 }
1642 }
1643 }
|
1619
1620 /**
1621 * Finds a species for an element type of {@code double} and shape.
1622 *
1623 * @param s the shape
1624 * @param <S> the type of shape
1625 * @return a species for an element type of {@code double} and shape
1626 * @throws IllegalArgumentException if no such species exists for the shape
1627 */
1628 @SuppressWarnings("unchecked")
1629 public static <S extends Shape> DoubleSpecies<S> species(S s) {
1630 Objects.requireNonNull(s);
1631 if (s == Shapes.S_64_BIT) {
1632 return (DoubleSpecies<S>) Double64Vector.SPECIES;
1633 } else if (s == Shapes.S_128_BIT) {
1634 return (DoubleSpecies<S>) Double128Vector.SPECIES;
1635 } else if (s == Shapes.S_256_BIT) {
1636 return (DoubleSpecies<S>) Double256Vector.SPECIES;
1637 } else if (s == Shapes.S_512_BIT) {
1638 return (DoubleSpecies<S>) Double512Vector.SPECIES;
1639 } else if (s == Shapes.S_Scalable_BIT) {
1640 return (DoubleSpecies<S>) DoubleScalableVector.SPECIES;
1641 } else {
1642 throw new IllegalArgumentException("Bad shape: " + s);
1643 }
1644 }
1645 }
|