- /*
- * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
- */
-
- package javax.mail.search;
-
- import java.util.Date;
- import javax.mail.Message;
-
- /**
- * This class implements comparisons for the Message SentDate.
- *
- * @author Bill Shannon
- * @author John Mani
- */
- public final class SentDateTerm extends DateTerm {
-
- /**
- * Constructor.
- *
- * @param comparison the Comparison type
- * @param date the date to be compared
- */
- public SentDateTerm(int comparison, Date date) {
- super(comparison, date);
- }
-
- /**
- * The match method.
- *
- * @param msg the date comparator is applied to this Message's
- * sent date
- * @return true if the comparison succeeds, otherwise false
- */
- public boolean match(Message msg) {
- Date d;
-
- try {
- d = msg.getSentDate();
- } catch (Exception e) {
- return false;
- }
-
- if (d == null)
- return false;
-
- return super.match(d);
- }
-
- /**
- * Equality comparison.
- */
- public boolean equals(Object obj) {
- if (!(obj instanceof SentDateTerm))
- return false;
- return super.equals(obj);
- }
- }