/[classpath]/inetlib/source/gnu/inet/imap/ListEntry.java
ViewVC logotype

Diff of /inetlib/source/gnu/inet/imap/ListEntry.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by dog, Thu Oct 21 15:21:55 2004 UTC revision 1.5 by dog, Thu Nov 25 22:15:05 2004 UTC
# Line 1  Line 1 
1  /*  /*
2   * $Id$   * ListEntry.java
3   * Copyright (C) 2003 The Free Software Foundation   * Copyright (C) 2003 The Free Software Foundation
4   *   *
5   * This file is part of GNU inetlib, a library.   * This file is part of GNU inetlib, a library.
# Line 44  import java.util.List; Line 44  import java.util.List;
44   * An item in an IMAP LIST or LSUB response.   * An item in an IMAP LIST or LSUB response.
45   *   *
46   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
  * @version $Revision$ $Date$  
47   */   */
48  public class ListEntry implements IMAPConstants  public class ListEntry
49      implements IMAPConstants
50  {  {
51    
52    private String mailbox;    private String mailbox;
# Line 62  public class ListEntry implements IMAPCo Line 62  public class ListEntry implements IMAPCo
62     * Constructor.     * Constructor.
63     * The list entry is otherwise immutable.     * The list entry is otherwise immutable.
64     */     */
65    ListEntry (String mailbox, char delimiter, boolean noinferiors,    ListEntry(String mailbox, char delimiter, boolean noinferiors,
66               boolean noselect, boolean marked, boolean unmarked)              boolean noselect, boolean marked, boolean unmarked)
67      {    {
68        this.mailbox = mailbox;      this.mailbox = mailbox;
69        this.delimiter = delimiter;      this.delimiter = delimiter;
70        this.noinferiors = noinferiors;      this.noinferiors = noinferiors;
71        this.noselect = noselect;      this.noselect = noselect;
72        this.marked = marked;      this.marked = marked;
73        this.unmarked = unmarked;      this.unmarked = unmarked;
74      }    }
75      
76    /**    /**
77     * Returns the mailbox this list entry refers to.     * Returns the mailbox this list entry refers to.
78     */     */
79    public String getMailbox ()    public String getMailbox()
80      {    {
81        return mailbox;      return mailbox;
82      }    }
83      
84    /**    /**
85     * Returns the mailbox hierarchy delimiter.     * Returns the mailbox hierarchy delimiter.
86     */     */
87    public char getDelimiter ()    public char getDelimiter()
88      {    {
89        return delimiter;      return delimiter;
90      }    }
91    
92    /**    /**
93     * If true: it is not possible for any child levels of hierarchy to     * If true: it is not possible for any child levels of hierarchy to
94     * exist under this name; no child levels exist now and none can be     * exist under this name; no child levels exist now and none can be
95     * created in the future.     * created in the future.
96     */     */
97    public boolean isNoinferiors ()    public boolean isNoinferiors()
98      {    {
99        return noinferiors;      return noinferiors;
100      }    }
101      
102    /**    /**
103     * If true: it is not possible to use this name as a selectable     * If true: it is not possible to use this name as a selectable
104     * mailbox.     * mailbox.
105     */     */
106    public boolean isNoselect ()    public boolean isNoselect()
107      {    {
108        return noselect;      return noselect;
109      }    }
110    
111    /**    /**
112     * If true: the mailbox has been marked "interesting" by the server;     * If true: the mailbox has been marked "interesting" by the server;
113     * the mailbox probably contains messages that have been added since     * the mailbox probably contains messages that have been added since
114     * the last time the mailbox was selected.     * the last time the mailbox was selected.
115     */     */
116    public boolean isMarked ()    public boolean isMarked()
117      {    {
118        return marked;      return marked;
119      }    }
120    
121    /**    /**
122     * If true: the mailbox does not contain any additional messages since     * If true: the mailbox does not contain any additional messages since
123     * the last time the mailbox was selected.     * the last time the mailbox was selected.
124     */     */
125    public boolean isUnmarked ()    public boolean isUnmarked()
126      {    {
127        return unmarked;      return unmarked;
128      }    }
129    
130    /**    /**
131     * Debugging     * Debugging
132     */     */
133    public String toString()    public String toString()
134      {    {
135        StringBuffer buffer = new StringBuffer ();      StringBuffer buffer = new StringBuffer();
136        if (noinferiors || noselect || marked || unmarked)      if (noinferiors || noselect || marked || unmarked)
137          {        {
138            buffer.append ("(\u001b[00;35m");          buffer.append("(\u001b[00;35m");
139            boolean seq = false;          boolean seq = false;
140            seq = conditionalAppend (buffer, seq, noinferiors, LIST_NOINFERIORS);          seq = conditionalAppend(buffer, seq, noinferiors, LIST_NOINFERIORS);
141            seq = conditionalAppend (buffer, seq, noselect, LIST_NOSELECT);          seq = conditionalAppend(buffer, seq, noselect, LIST_NOSELECT);
142            seq = conditionalAppend (buffer, seq, marked, LIST_MARKED);          seq = conditionalAppend(buffer, seq, marked, LIST_MARKED);
143            seq = conditionalAppend (buffer, seq, unmarked, LIST_UNMARKED);          seq = conditionalAppend(buffer, seq, unmarked, LIST_UNMARKED);
144            buffer.append ("\u001b[00m) ");          buffer.append("\u001b[00m) ");
145          }        }
146        buffer.append ("\"\u001b[00;31m");      buffer.append("\"\u001b[00;31m");
147        buffer.append (delimiter);      buffer.append(delimiter);
148        buffer.append ("\u001b[00m\" ");      buffer.append("\u001b[00m\" ");
149        buffer.append (mailbox);      buffer.append(mailbox);
150        return buffer.toString ();      return buffer.toString();
151      }    }
152      
153    private static boolean conditionalAppend (StringBuffer buffer,    private static boolean conditionalAppend(StringBuffer buffer,
154                                              boolean seq, boolean test,                                             boolean seq, boolean test,
155                                              String value)                                             String value)
156      {    {
157        if (test)      if (test)
158          {        {
159            if (seq)          if (seq)
160              {            {
161                buffer.append (' ');              buffer.append(' ');
162              }            }
163            buffer.append (value);          buffer.append(value);
164            seq = true;          seq = true;
165          }        }
166        return seq;      return seq;
167      }    }
168      
169  }  }
170    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26