- /*
- * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
- */
-
- package javax.mail.search;
-
- import javax.mail.Message;
-
- /**
- * This class implements comparisons for Message numbers.
- *
- * @author Bill Shannon
- * @author John Mani
- */
- public final class MessageNumberTerm extends IntegerComparisonTerm {
-
- /**
- * Constructor.
- *
- * @param number the Message number
- */
- public MessageNumberTerm(int number) {
- super(EQ, number);
- }
-
- /**
- * The match method.
- *
- * @param msg the Message number is matched with this Message
- * @return true if the match succeeds, otherwise false
- */
- public boolean match(Message msg) {
- int msgno;
-
- try {
- msgno = msg.getMessageNumber();
- } catch (Exception e) {
- return false;
- }
-
- return super.match(msgno);
- }
-
- /**
- * Equality comparison.
- */
- public boolean equals(Object obj) {
- if (!(obj instanceof MessageNumberTerm))
- return false;
- return super.equals(obj);
- }
- }