Class QueryCursor

  • All Implemented Interfaces:
    AutoCloseable, Iterable<QueryMatch>

    public class QueryCursor
    extends Object
    implements Iterable<QueryMatch>
    Cursor used for executing queries, carrying the state needed to process them.

    The query cursor should not be shared between threads, but can be reused for many query executions.

    Since:
    1.0.0
    Author:
    Ozren Dabić
    • Method Detail

      • execute

        public void execute()
        Start running a query against a node.
      • setRange

        public void setRange​(int startByte,
                             int endByte)
        Set the range of bytes positions in which the query will be executed.
        Parameters:
        startByte - The start byte of the query range
        endByte - The end byte of the query range
        Throws:
        ByteOffsetOutOfBoundsException - if either argument is outside the queried node's byte range
        IllegalArgumentException - if:
        • startByte < 0
        • endByte < 0
        • startByte > endByte
        Since:
        1.9.0
      • setRange

        public void setRange​(@NotNull
                             @NotNull Point startPoint,
                             @NotNull
                             @NotNull Point endPoint)
        Set the range of row-column coordinates in which the query will be executed.
        Parameters:
        startPoint - The start point of the query range
        endPoint - The end point of the query range
        Throws:
        NullPointerException - if either argument is null
        IllegalArgumentException - if any point coordinates are negative, or if startPoint is a position that comes after endPoint
        PointOutOfBoundsException - if any of the arguments is outside the queried node's position range
        Since:
        1.9.0
      • nextMatch

        public QueryMatch nextMatch()
        Advance to the next match of the currently running query.
        Returns:
        A match if there is one, null otherwise
        Throws:
        IllegalStateException - if the query was not executed beforehand
        See Also:
        execute()
      • isNull

        public final boolean isNull()
        Checks whether the memory address associated with this external resource is nullptr.
        Returns:
        true if the memory address is 0, otherwise false
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • close

        public void close()
        Delete the external resource, freeing all the memory that it used.
        Specified by:
        close in interface AutoCloseable