FileDocCategorySizeDatePackage
DateTerm.javaAPI DocGlassfish v2 API3750Mon May 14 15:28:50 BST 2007javax.mail.search

DateTerm

public abstract class DateTerm extends ComparisonTerm
This class implements comparisons for Dates
author
Bill Shannon
author
John Mani

Fields Summary
protected Date
date
The date.
private static final long
serialVersionUID
Constructors Summary
protected DateTerm(int comparison, Date date)
Constructor.

param
comparison the comparison type
param
date The Date to be compared against


                        
         
	this.comparison = comparison;
	this.date = date;
    
Methods Summary
public booleanequals(java.lang.Object obj)
Equality comparison.

	if (!(obj instanceof DateTerm))
	    return false;
	DateTerm dt = (DateTerm)obj;
	return dt.date.equals(this.date) && super.equals(obj);
    
public intgetComparison()
Return the type of comparison.

	return comparison;
    
public java.util.DategetDate()
Return the Date to compare with.

	return new Date(date.getTime());
    
public inthashCode()
Compute a hashCode for this object.

	return date.hashCode() + super.hashCode();
    
protected booleanmatch(java.util.Date d)
The date comparison method.

param
d the date in the constructor is compared with this date
return
true if the dates match, otherwise false

	switch (comparison) {
	    case LE: 
		return d.before(date) || d.equals(date);
	    case LT:
		return d.before(date);
	    case EQ:
		return d.equals(date);
	    case NE:
		return !d.equals(date);
	    case GT:
		return d.after(date);
	    case GE:
		return d.after(date) || d.equals(date);
	    default:
		return false;
	}