= QueryRange
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

To support paging of query results, specifies an offset/start instance and limits the number of instances to be retrieved.

Used by _NamedQuery#withRange(QueryRange)_ and _AllInstancesQuery#withRange(QueryRange)_ .

== API

[source,java]
.QueryRange.java
----
interface QueryRange {
  boolean isUnconstrained()     // <.>
  boolean hasOffset()     // <.>
  boolean hasLimit()     // <.>
  long getStart()     // <.>
  long getLimit()     // <.>
  long getEnd()     // <.>
  int getStartAsInt()     // <.>
  int getLimitAsInt()     // <.>
  int getEndAsInt()     // <.>
  QueryRange unconstrained()
  QueryRange start(long start)
  QueryRange limit(long limit)
  QueryRange of(long... range)
  QueryRange withStart(long start)
  QueryRange withLimit(long limit)
}
----

<.> xref:#isUnconstrained_[isUnconstrained()]
+
--
Whether this range is unconstrained, meaning that there is _#hasOffset() no offset_ and _#hasLimit() no limit_ has been specified.
--
<.> xref:#hasOffset_[hasOffset()]
+
--
Whether this range has had a non-zero offset specified using _#withStart(long)_ .
--
<.> xref:#hasLimit_[hasLimit()]
+
--
Whether this range has a limit to the number of instances to be returned using _#withLimit(long)_ .
--
<.> xref:#getStart_[getStart()]
+
--
The start index into the set table. (non-negative)
--
<.> xref:#getLimit_[getLimit()]
+
--
The maximum number of items to return, starting at _#getStart()_ (non-negative).
--
<.> xref:#getEnd_[getEnd()]
+
--
The end index into the set table. Overflow is ignored. (non-negative)
--
<.> xref:#getStartAsInt_[getStartAsInt()]
+
--
The start index into the set table (as java int primitive)
--
<.> xref:#getLimitAsInt_[getLimitAsInt()]
+
--
The maximum number of items to return (as java int primitive) if _limit_ overflows an int, _Integer#MAX_VALUE_ is returned.
--
<.> xref:#getEndAsInt_[getEndAsInt()]
+
--
The end index into the set table. Overflow is ignored. (as java int primitive) if _end_ overflows an int, _Integer#MAX_VALUE_ is returned.
--

== Members

[#isUnconstrained_]
=== isUnconstrained()

Whether this range is unconstrained, meaning that there is _#hasOffset() no offset_ and _#hasLimit() no limit_ has been specified.

[#hasOffset_]
=== hasOffset()

Whether this range has had a non-zero offset specified using _#withStart(long)_ .

[#hasLimit_]
=== hasLimit()

Whether this range has a limit to the number of instances to be returned using _#withLimit(long)_ .

[#getStart_]
=== getStart()

The start index into the set table. (non-negative)

[#getLimit_]
=== getLimit()

The maximum number of items to return, starting at _#getStart()_ (non-negative).

[#getEnd_]
=== getEnd()

The end index into the set table. Overflow is ignored. (non-negative)

[#getStartAsInt_]
=== getStartAsInt()

The start index into the set table (as java int primitive)

[#getLimitAsInt_]
=== getLimitAsInt()

The maximum number of items to return (as java int primitive) if _limit_ overflows an int, _Integer#MAX_VALUE_ is returned.

[#getEndAsInt_]
=== getEndAsInt()

The end index into the set table. Overflow is ignored. (as java int primitive) if _end_ overflows an int, _Integer#MAX_VALUE_ is returned.
