< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -514,10 +514,12 @@
      /**
       * Tests if the lane at index {@code i} is set
       * @param i the lane index
       *
       * @return true if the lane at index {@code i} is set, otherwise false
+      * @throws IndexOutOfBoundsException if the index is out of range
+      * ({@code < 0 || >= length()})
       */
      public abstract boolean laneIsSet(int i);
  
      /**
       * Checks that this mask applies to vectors with the given element type,

@@ -551,10 +553,28 @@
       * @see Vector#check(Class)
       * @see Vector#check(VectorSpecies)
       */
      public abstract <F> VectorMask<F> check(VectorSpecies<F> species);
  
+     /**
+      * Checks that this mask has the same class with the given mask class,
+      * and it has the same species with given vector's species,
+      * and returns this mask unchanged.
+      * The effect is similar to this pseudocode:
+      * {@code getClass() == maskClass &&
+      *        vectorSpecies() == vector.species()
+      *        ? this
+      *        : throw new ClassCastException()}.
+      *
+      * @param maskClass the class required for this mask
+      * @param vector its species required for this mask
+      * @param <F> the boxed element type of the required species
+      * @return the same mask
+      * @throws ClassCastException if the species is wrong
+      */
+     abstract <F> VectorMask<F> check(Class<? extends VectorMask<F>> maskClass, Vector<F> vector);
+ 
      /**
       * Returns a string representation of this mask, of the form
       * {@code "Mask[T.TT...]"}, reporting the mask bit
       * settings (as 'T' or '.' characters) in lane order.
       *
< prev index next >