Package com.sun.mail.imap.protocol

## Class SearchSequence

- java.lang.Object
- - com.sun.mail.imap.protocol.SearchSequence

Direct Known Subclasses:
  `GmailSearchSequence`

    public class SearchSequence
    extends java.lang.Object

This class traverses a search-tree and generates the corresponding IMAP search sequence. Each IMAPProtocol instance contains an instance of this class, which might be subclassed by subclasses of IMAPProtocol to add support for additional product-specific search terms.

Author:
  John Mani, Bill Shannon

### Field Summary

Fields
`protected java.util.Calendar` `cal`

### Constructor Summary

Constructors
`SearchSequence()` Deprecated.
`SearchSequence​(IMAPProtocol p)` Create a SearchSequence for this IMAPProtocol.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected Argument` `and​(AndTerm term, java.lang.String charset)`
`protected Argument` `body​(BodyTerm term, java.lang.String charset)`
`protected Argument` `flag​(FlagTerm term)`
`protected Argument` `from​(java.lang.String address, java.lang.String charset)`
`Argument` `generateSequence​(SearchTerm term, java.lang.String charset)` Generate the IMAP search sequence for the given search expression.
`protected Argument` `header​(HeaderTerm term, java.lang.String charset)`
`static boolean` `isAscii​(java.lang.String s)` Does this string contain only ASCII characters?
`static boolean` `isAscii​(SearchTerm term)` Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.
`static boolean` `isAscii​(SearchTerm[] terms)` Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.
`protected Argument` `messageid​(MessageIDTerm term, java.lang.String charset)`
`protected Argument` `modifiedSince​(ModifiedSinceTerm term)` Generate argument for ModifiedSinceTerm.
`protected Argument` `not​(NotTerm term, java.lang.String charset)`
`protected Argument` `older​(OlderTerm term)` Generate argument for OlderTerm.
`protected Argument` `or​(OrTerm term, java.lang.String charset)`
`protected Argument` `receiveddate​(DateTerm term)`
`protected Argument` `recipient​(Message.RecipientType type, java.lang.String address, java.lang.String charset)`
`protected Argument` `sentdate​(DateTerm term)`
`protected Argument` `size​(SizeTerm term)`
`protected Argument` `subject​(SubjectTerm term, java.lang.String charset)`
`protected java.lang.String` `toIMAPDate​(java.util.Date date)`
`protected Argument` `younger​(YoungerTerm term)` Generate argument for YoungerTerm.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### cal

    protected java.util.Calendar cal

### Constructor Detail

#### SearchSequence

    public SearchSequence​(IMAPProtocol p)

Create a SearchSequence for this IMAPProtocol.

Parameters:
  `p` - the IMAPProtocol object for the server
Since:
  JavaMail 1.6.0

#### SearchSequence

    @Deprecated
    public SearchSequence()

Deprecated.
Create a SearchSequence.

### Method Detail

#### generateSequence

    public Argument generateSequence​(SearchTerm term,
                                     java.lang.String charset)
                              throws SearchException,
                                     java.io.IOException

Generate the IMAP search sequence for the given search expression.

Parameters:
  `term` - the search term
  `charset` - charset for the search
Returns:
  the SEARCH Argument
Throws:
  `SearchException` - for failures
  `java.io.IOException` - for I/O errors

#### isAscii

    public static boolean isAscii​(SearchTerm term)

Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.

Parameters:
  `term` - the search term
Returns:
  true if only ASCII

#### isAscii

    public static boolean isAscii​(SearchTerm[] terms)

Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.

Parameters:
  `terms` - the search terms
Returns:
  true if only ASCII

#### isAscii

    public static boolean isAscii​(java.lang.String s)

Does this string contain only ASCII characters?

Parameters:
  `s` - the string
Returns:
  true if only ASCII

#### and

    protected Argument and​(AndTerm term,
                           java.lang.String charset)
                    throws SearchException,
                           java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### or

    protected Argument or​(OrTerm term,
                          java.lang.String charset)
                   throws SearchException,
                          java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### not

    protected Argument not​(NotTerm term,
                           java.lang.String charset)
                    throws SearchException,
                           java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### header

    protected Argument header​(HeaderTerm term,
                              java.lang.String charset)
                       throws SearchException,
                              java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### messageid

    protected Argument messageid​(MessageIDTerm term,
                                 java.lang.String charset)
                          throws SearchException,
                                 java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### flag

    protected Argument flag​(FlagTerm term)
                     throws SearchException

Throws:
  `SearchException`

#### from

    protected Argument from​(java.lang.String address,
                            java.lang.String charset)
                     throws SearchException,
                            java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### recipient

    protected Argument recipient​(Message.RecipientType type,
                                 java.lang.String address,
                                 java.lang.String charset)
                          throws SearchException,
                                 java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### subject

    protected Argument subject​(SubjectTerm term,
                               java.lang.String charset)
                        throws SearchException,
                               java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### body

    protected Argument body​(BodyTerm term,
                            java.lang.String charset)
                     throws SearchException,
                            java.io.IOException

Throws:
  `SearchException`
  `java.io.IOException`

#### size

    protected Argument size​(SizeTerm term)
                     throws SearchException

Throws:
  `SearchException`

#### toIMAPDate

    protected java.lang.String toIMAPDate​(java.util.Date date)

#### sentdate

    protected Argument sentdate​(DateTerm term)
                         throws SearchException

Throws:
  `SearchException`

#### receiveddate

    protected Argument receiveddate​(DateTerm term)
                             throws SearchException

Throws:
  `SearchException`

#### older

    protected Argument older​(OlderTerm term)
                      throws SearchException

Generate argument for OlderTerm.

Parameters:
  `term` - the search term
Returns:
  the SEARCH Argument
Throws:
  `SearchException` - for failures
Since:
  JavaMail 1.5.1

#### younger

    protected Argument younger​(YoungerTerm term)
                        throws SearchException

Generate argument for YoungerTerm.

Parameters:
  `term` - the search term
Returns:
  the SEARCH Argument
Throws:
  `SearchException` - for failures
Since:
  JavaMail 1.5.1

#### modifiedSince

    protected Argument modifiedSince​(ModifiedSinceTerm term)
                              throws SearchException

Generate argument for ModifiedSinceTerm.

Parameters:
  `term` - the search term
Returns:
  the SEARCH Argument
Throws:
  `SearchException` - for failures
Since:
  JavaMail 1.5.1