1361
1362 /**
1363 * Finds a species for an element type of {@code long} and shape.
1364 *
1365 * @param s the shape
1366 * @param <S> the type of shape
1367 * @return a species for an element type of {@code long} and shape
1368 * @throws IllegalArgumentException if no such species exists for the shape
1369 */
1370 @SuppressWarnings("unchecked")
1371 public static <S extends Shape> LongSpecies<S> species(S s) {
1372 Objects.requireNonNull(s);
1373 if (s == Shapes.S_64_BIT) {
1374 return (LongSpecies<S>) Long64Vector.SPECIES;
1375 } else if (s == Shapes.S_128_BIT) {
1376 return (LongSpecies<S>) Long128Vector.SPECIES;
1377 } else if (s == Shapes.S_256_BIT) {
1378 return (LongSpecies<S>) Long256Vector.SPECIES;
1379 } else if (s == Shapes.S_512_BIT) {
1380 return (LongSpecies<S>) Long512Vector.SPECIES;
1381 } else {
1382 throw new IllegalArgumentException("Bad shape: " + s);
1383 }
1384 }
1385 }
|
1361
1362 /**
1363 * Finds a species for an element type of {@code long} and shape.
1364 *
1365 * @param s the shape
1366 * @param <S> the type of shape
1367 * @return a species for an element type of {@code long} and shape
1368 * @throws IllegalArgumentException if no such species exists for the shape
1369 */
1370 @SuppressWarnings("unchecked")
1371 public static <S extends Shape> LongSpecies<S> species(S s) {
1372 Objects.requireNonNull(s);
1373 if (s == Shapes.S_64_BIT) {
1374 return (LongSpecies<S>) Long64Vector.SPECIES;
1375 } else if (s == Shapes.S_128_BIT) {
1376 return (LongSpecies<S>) Long128Vector.SPECIES;
1377 } else if (s == Shapes.S_256_BIT) {
1378 return (LongSpecies<S>) Long256Vector.SPECIES;
1379 } else if (s == Shapes.S_512_BIT) {
1380 return (LongSpecies<S>) Long512Vector.SPECIES;
1381 } else if (s == Shapes.S_Scalable_BIT) {
1382 return (LongSpecies<S>) LongScalableVector.SPECIES;
1383 } else {
1384 throw new IllegalArgumentException("Bad shape: " + s);
1385 }
1386 }
1387 }
|