SK.gnome.dwarf.mail.store.search
Class DateKey

java.lang.Object
  extended bySK.gnome.dwarf.mail.store.search.SearchKey
      extended bySK.gnome.dwarf.mail.store.search.DateKey
Direct Known Subclasses:
DateHeaderKey, InternalDateKey

public abstract class DateKey
extends SearchKey

This key matches the given date/time and the message's date/time.


Field Summary
static int BEFORE
          This key type specifies that values before the specified date/time will be matched.
static int ON
          This key type specifies that values equal to the specified date/time will be matched.
static int SINCE
          This key type specifies that values after the specified date/time will be matched.
protected  long time
          The matched date/time.
 
Fields inherited from class SK.gnome.dwarf.mail.store.search.SearchKey
type
 
Constructor Summary
DateKey(int type, long time)
          Creates a new DateKey.
 
Method Summary
 long getTime()
          Returns the matched date/time.
protected abstract  long getTime(MailMessage message)
          Returns the message date/time to match the given date/time.
 boolean match(MailMessage message)
          Matches the given date/time and the message's date/time.
 java.lang.String toString()
          Returns the string represenation of the key.
 
Methods inherited from class SK.gnome.dwarf.mail.store.search.SearchKey
addError, clearErrors, getErrors, getType, hasError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEFORE

public static final int BEFORE
This key type specifies that values before the specified date/time will be matched.

See Also:
Constant Field Values

ON

public static final int ON
This key type specifies that values equal to the specified date/time will be matched.

See Also:
Constant Field Values

SINCE

public static final int SINCE
This key type specifies that values after the specified date/time will be matched.

See Also:
Constant Field Values

time

protected long time
The matched date/time.

Constructor Detail

DateKey

public DateKey(int type,
               long time)
Creates a new DateKey.

Parameters:
time - the matched date/time
Method Detail

getTime

public long getTime()
Returns the matched date/time.

Returns:
the date/time

match

public boolean match(MailMessage message)
              throws MailException
Matches the given date/time and the message's date/time.

The message date/time is obtained via the abstract getTime(MailMessage) method.

Specified by:
match in class SearchKey
Parameters:
message - the searched message
Returns:
true if the given key criteria and message matches, false otherwise
Throws:
MailException - if an error occurs

toString

public java.lang.String toString()
Description copied from class: SearchKey
Returns the string represenation of the key.

Overrides:
toString in class SearchKey
Returns:
the key string

getTime

protected abstract long getTime(MailMessage message)
                         throws MailException
Returns the message date/time to match the given date/time.

It may return -1 if the time information could not be obtained from the message.

Parameters:
message - the searched message
Returns:
the message date/time or -1 if not available
Throws:
MailException - if an error occured


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.