Jwma

dtw.webmail.model
Class JwmaMessageInfoListImpl

java.lang.Object
  |
  +--dtw.webmail.model.JwmaMessageInfoListImpl

public class JwmaMessageInfoListImpl
extends java.lang.Object

Class implementing a list for JwmaMessageInfo instances. It has caching functionality, which reduces the need to reconstruct the list after moving and deleting messages.

Version:
0.9.7 07/02/2003
Author:
Dieter Wimberger

Field Summary
protected  boolean m_HasDeleted
           
protected  int m_LastSortCriteria
           
protected  java.util.List m_MessageInfos
           
 
Method Summary
static JwmaMessageInfoListImpl createJwmaMessageInfoListImpl(javax.mail.Folder f)
          Factory method that creates a new JwmaMessageInfoListImpl instance wrapping the list of messages in the given folder.
static JwmaMessageInfoListImpl createJwmaMessageInfoListImpl(javax.mail.Message[] messages)
          Factory method that creates a new JwmaMessageInfoListImpl instance from the given array of messages.
 int getLastSortCriteria()
          Returns the last used sort criteria as int.
 int getListIndex(int msgnum)
          Returns the list index of message given by it's message number.
 int getNextMessageNumber(int msgnum)
          Returns the message number of the next message in the list, observing the sorting.
 int getPreviousMessageNumber(int msgnum)
          Returns the message number of the previous message in the list, observing the sorting.
 java.util.Iterator iterator()
          Returns an Iterator over the JwmaMessageInfoImpl instances contained within this list.
 JwmaMessageInfoImpl[] listMessageInfos()
          Returns an array of JwmaMessageInfo[] listing the info's stored in this list.
 void remove(int[] msgsnums)
          Removes the items with the given numbers from this list.
 void removeDeleted()
          Removes items that are flagged deleted from this list.
 void renumber()
          Renumbers the items in this list.
 int size()
          Returns the size of this list.
 void sort(int criteria)
          Sorts this MessageInfoListImpl by the given criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_MessageInfos

protected java.util.List m_MessageInfos

m_HasDeleted

protected boolean m_HasDeleted

m_LastSortCriteria

protected int m_LastSortCriteria
Method Detail

size

public int size()
Returns the size of this list.

Returns:
the size of this list.

listMessageInfos

public JwmaMessageInfoImpl[] listMessageInfos()
Returns an array of JwmaMessageInfo[] listing the info's stored in this list.

Returns:
an array of JwmaMessageInfo instances.
See Also:
listMessageInfos()

sort

public void sort(int criteria)
Sorts this MessageInfoListImpl by the given criteria. If the criteria does not match any existing Comparator then the method returns without action. The used criteria is remembered for possible re-sorting.

Parameters:
criteria - the criteria used for sorting.
See Also:
MessageSortCriterias, MessageSortingUtil

getLastSortCriteria

public int getLastSortCriteria()
Returns the last used sort criteria as int.

Returns:
the last sort criteria as int.

getNextMessageNumber

public int getNextMessageNumber(int msgnum)
Returns the message number of the next message in the list, observing the sorting. The method returns -1 if the message does not exist in the list, or when there is no next message.

Parameters:
msgnum - the message number of the message to start from.
Returns:
the messagenumber of the next message as int.

getPreviousMessageNumber

public int getPreviousMessageNumber(int msgnum)
Returns the message number of the previous message in the list, observing the sorting. The method returns -1 if the message does not exist in the list, or when there is no previous message.

Parameters:
msgnum - the message number of the message to start from.
Returns:
the messagenumber of the previous message as int.

getListIndex

public int getListIndex(int msgnum)
Returns the list index of message given by it's message number.

Returns:
the list index as int.

iterator

public java.util.Iterator iterator()
Returns an Iterator over the JwmaMessageInfoImpl instances contained within this list.

Returns:
the Iterator over the items in this list.

remove

public void remove(int[] msgsnums)
Removes the items with the given numbers from this list.

Parameters:
msgsnums - the numbers of the items to be removed as int[].

removeDeleted

public void removeDeleted()
Removes items that are flagged deleted from this list. This method can be used to clean out those messages when the folder was closed with expunging.


renumber

public void renumber()
Renumbers the items in this list. This message should be called if items were removed from this list.


createJwmaMessageInfoListImpl

public static JwmaMessageInfoListImpl createJwmaMessageInfoListImpl(javax.mail.Message[] messages)
                                                             throws JwmaException
Factory method that creates a new JwmaMessageInfoListImpl instance from the given array of messages.

Parameters:
messages - array of javax.mail.Message instances.
Returns:
the newly created JwmaMessageInfoListImpl instance.
Throws:
JwmaException - if it fails to build the list.

createJwmaMessageInfoListImpl

public static JwmaMessageInfoListImpl createJwmaMessageInfoListImpl(javax.mail.Folder f)
                                                             throws JwmaException
Factory method that creates a new JwmaMessageInfoListImpl instance wrapping the list of messages in the given folder.

Parameters:
f - the javax.mail.Folder instance, the new list instance should be created for.
Returns:
the newly created JwmaMessageInfoListImpl instance.
Throws:
JwmaException - if it fails retrieve the list of javax.mail.Message instances from the folder, or when it fails to build the list.

Jwma

Copyright © 2000-2003 jwma team (All Rights Reserved.)