reshuffling of file locations to make package structure flatter
[org.ibex.mail.git] / src / org / ibex / mail / MessageArrayMailbox.java
diff --git a/src/org/ibex/mail/MessageArrayMailbox.java b/src/org/ibex/mail/MessageArrayMailbox.java
new file mode 100644 (file)
index 0000000..3ac15cb
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
+
+package org.ibex.mail;
+import org.ibex.util.*;
+import org.ibex.mail.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.text.*;
+
+public class MessageArrayMailbox extends Mailbox.Default {
+
+    private final Message[] messages;
+
+    public MessageArrayMailbox(Message[] messages) { this.messages = messages; }
+
+    public void             insert(Message message, int flags) { return; }
+    public int              uidNext() { return messages.length+1; }
+    public Mailbox.Iterator iterator() { return new MessageArrayMailbox.Iterator(); }
+
+    public class Iterator extends Mailbox.Default.Iterator {
+        private int position = -1;
+
+        public Message cur()  { return messages[position]; }
+        public Headers head() { return messages[position].headers; }
+        public boolean next() { return ++position < messages.length; }
+        public int     uid()  { return position+1; }
+        public int     imapNumber()  { return position+1; }
+        public void    delete() { return; }
+
+    }
+}