01: /**
02: * Copyright (C) 2006 NetMind Consulting Bt.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 3 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package hu.netmind.persistence;
18:
19: /**
20: * A simple object which holds limits to a selection.
21: * Offset means the index of first row returned after applying the
22: * conditions and ordering. Limit means to return at most the given amount
23: * of rows. A limit of 0 means no limit.
24: * @author Brautigam Robert
25: * @version Revision: $Revision$
26: */
27: public class Limits {
28: private long offset;
29: private long limit;
30: private long size;
31:
32: public Limits(int offset, int limit, int size) {
33: setOffset(offset);
34: setLimit(limit);
35: setSize(size);
36: }
37:
38: public long getOffset() {
39: return offset;
40: }
41:
42: public void setOffset(long offset) {
43: this .offset = offset;
44: }
45:
46: public long getLimit() {
47: return limit;
48: }
49:
50: public void setLimit(long limit) {
51: this .limit = limit;
52: }
53:
54: public boolean isEmpty() {
55: return (limit <= 0);
56: }
57:
58: public long getSize() {
59: return size;
60: }
61:
62: public void setSize(long size) {
63: this .size = size;
64: }
65:
66: public String toString() {
67: return "[Limit: " + offset + "-" + limit + "]";
68: }
69: }
|