aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java
diff options
context:
space:
mode:
authorEmil Ivov <emcho@jitsi.org>2005-11-02 14:08:43 +0000
committerEmil Ivov <emcho@jitsi.org>2005-11-02 14:08:43 +0000
commitc82e7e1327fd89ec30929a7d4e529039b751bf41 (patch)
treeb2694122644e90a21bd0348f81a53a45841a37dd /src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java
parent462770b17bdbdffcf61b8862635738e46d58e505 (diff)
downloadjitsi-c82e7e1327fd89ec30929a7d4e529039b751bf41.zip
jitsi-c82e7e1327fd89ec30929a7d4e529039b751bf41.tar.gz
jitsi-c82e7e1327fd89ec30929a7d4e529039b751bf41.tar.bz2
Initial sip-communicator-1.0 commit
Diffstat (limited to 'src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java')
-rw-r--r--src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java b/src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java
new file mode 100644
index 0000000..2dc21bb
--- /dev/null
+++ b/src/net/java/sip/communicator/service/history/DefaultQueryResultSet.java
@@ -0,0 +1,65 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */package net.java.sip.communicator.service.history;
+
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+import net.java.sip.communicator.service.history.records.HistoryRecord;
+
+/**
+ * @author Alexander Pelov
+ */
+public class DefaultQueryResultSet implements QueryResultSet {
+
+ private Vector records = new Vector();
+ private int currentPos = -1;
+
+ public DefaultQueryResultSet(Vector records) {
+ this.records = records;
+ }
+
+ public HistoryRecord nextRecord() throws NoSuchElementException {
+ return (HistoryRecord)this.next();
+ }
+
+ public HistoryRecord prevRecord() throws NoSuchElementException {
+ return (HistoryRecord)this.prev();
+ }
+
+ public boolean hasPrev() {
+ return this.currentPos-1 >= 0;
+ }
+
+ public Object prev() throws NoSuchElementException {
+ this.currentPos--;
+
+ if(this.currentPos < 0) {
+ throw new NoSuchElementException();
+ }
+
+ return records.get(this.currentPos);
+ }
+
+ public boolean hasNext() {
+ return this.currentPos+1 < this.records.size();
+ }
+
+ public Object next() {
+ this.currentPos++;
+
+ if(this.currentPos >= this.records.size()) {
+ throw new NoSuchElementException();
+ }
+
+ return records.get(this.currentPos);
+ }
+
+ public void remove() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException("Cannot remove elements " +
+ "from underlaying collection.");
+ }
+}