Class VectorMatch

  • All Implemented Interfaces:
    ReadableVectorMatch

    public class VectorMatch
    extends Object
    implements ReadableVectorMatch
    Implementation class for ReadableVectorMatch. Also adds some useful methods, like "addAll", "removeAll", and "copyFrom".
    • Method Detail

      • allTrue

        public static ReadableVectorMatch allTrue​(int numRows)
        Creates a match that matches everything up to "numRows". This will often be the current vector size, but does not necessarily have to be.
      • allFalse

        public static ReadableVectorMatch allFalse()
        Creates a match that matches nothing.
      • wrap

        public static VectorMatch wrap​(int[] selection)
        Creates a new match object with selectionSize = 0, and the provided array as a backing array.
      • isAllTrue

        public boolean isAllTrue​(int vectorSize)
        Description copied from interface: ReadableVectorMatch
        Checks if this match has accepted every row in the vector.
        Specified by:
        isAllTrue in interface ReadableVectorMatch
        Parameters:
        vectorSize - the current vector size; must be passed in since VectorMatch objects do not "know" the size of the vector they came from.
      • isValid

        public boolean isValid​(@Nullable
                               ReadableVectorMatch mask)
        Description copied from interface: ReadableVectorMatch
        Checks if this match is valid (increasing row numbers, no out-of-range row numbers). Can additionally verify that the match is a subset of a provided "mask". Used by assertions and tests.
        Specified by:
        isValid in interface ReadableVectorMatch
        Parameters:
        mask - if provided, checks if this match is a subset of the mask.
      • removeAll

        public VectorMatch removeAll​(ReadableVectorMatch other)
        Removes all rows from this object that occur in "other", in place, and returns a reference to this object. Does not modify "other". "other" cannot be the same instance as this object.
      • addAll

        public VectorMatch addAll​(ReadableVectorMatch other,
                                  VectorMatch scratch)
        Adds all rows from "other" to this object, using "scratch" as scratch space if needed. Does not modify "other". Returns a reference to this object. "other" and "scratch" cannot be the same instance as each other, or as this object.
      • copyFrom

        public void copyFrom​(ReadableVectorMatch other)
        Copies "other" into this object, and returns a reference to this object. Does not modify "other". "other" cannot be the same instance as this object.
      • getSelection

        public int[] getSelection()
        Description copied from interface: ReadableVectorMatch
        Returns an array of indexes into the current batch. Only the first "getSelectionSize" are valid. Even though this array is technically mutable, it is very poor form to mutate it if you are not the owner of the VectorMatch object. The reason we use a mutable array here instead of positional getter methods, by the way, is in the hopes of keeping access to the selection vector as low-level and optimizable as possible. Potential optimizations could include making it easier for the JVM to use CPU-level vectorization, avoid method calls, etc.
        Specified by:
        getSelection in interface ReadableVectorMatch
      • setSelectionSize

        public VectorMatch setSelectionSize​(int newSelectionSize)
        Sets the valid selectionSize, and returns a reference to this object.