change num() to imapNumber() and nntpNumber(), add comments about semantics
[org.ibex.mail.git] / src / org / ibex / mail / target / MessageArrayMailbox.java
1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache Public Source License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
4
5 package org.ibex.mail.target;
6 import org.ibex.mail.*;
7 import org.ibex.util.*;
8 import org.ibex.mail.*;
9 import java.io.*;
10 import java.net.*;
11 import java.util.*;
12 import java.text.*;
13
14 public class MessageArrayMailbox extends Mailbox.Default {
15
16     private final Message[] messages;
17
18     public MessageArrayMailbox(Message[] messages) { this.messages = messages; }
19
20     public void             add(Message message) { return; }
21     public void             add(Message message, int flags) { return; }
22     public int              uidNext() { return messages.length+1; }
23     public Mailbox.Iterator iterator() { return new MessageArrayMailbox.Iterator(); }
24
25     public class Iterator extends Mailbox.Default.Iterator {
26         private int position = -1;
27
28         public Message cur()  { return messages[position]; }
29         public Headers head() { return messages[position].headers; }
30         public boolean next() { return ++position < messages.length; }
31         public int     uid()  { return position+1; }
32         public int     imapNumber()  { return position+1; }
33         public void    delete() { return; }
34
35         public void    set(String key, String val) { return; }
36         public String  get(String key) { return null; }
37
38         public boolean seen() { return false; }
39         public boolean deleted() { return false; }
40         public boolean flagged() { return false; }
41         public boolean draft() { return false; }
42         public boolean answered() { return false; }
43         public boolean recent() { return true; }
44
45         public void    seen(boolean on) { return; }
46         public void    deleted(boolean on) { return; }
47         public void    flagged(boolean on) { return; }
48         public void    draft(boolean on) { return; }
49         public void    answered(boolean on) { return; }
50         public void    recent(boolean on) { return; }
51     }
52 }