/** * Equality comparison. */ public boolean equals(Object obj) { if (!(obj instanceof FromTerm)) return false; return super.equals(obj); } }
/** * Compute a hashCode for this object. */ public int hashCode() { return type.hashCode() + super.hashCode(); } }
/** * The address comparator. * * @param msg The address comparison is applied to this Message * @return true if the comparison succeeds, otherwise false */ public boolean match(Message msg) { Address[] from; try { from = msg.getFrom(); } catch (Exception e) { return false; } if (from == null) return false; for (int i=0; i < from.length; i++) if (super.match(from[i])) return true; return false; }
/** * Check if the "text" terms in the given SearchTerm contain * non US-ASCII characters. * * @param term the search term * @return true if only ASCII */ public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm) return isAscii(((AndTerm)term).getTerms()); else if (term instanceof OrTerm) return isAscii(((OrTerm)term).getTerms()); else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Check if the "text" terms in the given SearchTerm contain * non US-ASCII characters. * * @param term the search term * @return true if only ASCII */ public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm) return isAscii(((AndTerm)term).getTerms()); else if (term instanceof OrTerm) return isAscii(((OrTerm)term).getTerms()); else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Equality comparison. */ @Override public boolean equals(Object obj) { if (!(obj instanceof FromTerm)) return false; return super.equals(obj); } }
/** * The match method. * * @param msg The address match is applied to this Message's recepient * address * @return true if the match succeeds, otherwise false */ public boolean match(Message msg) { Address[] recipients; try { recipients = msg.getRecipients(type); } catch (Exception e) { return false; } if (recipients == null) return false; for (int i=0; i < recipients.length; i++) if (super.match(recipients[i])) return true; return false; }
/** * Compute a hashCode for this object. */ @Override public int hashCode() { return type.hashCode() + super.hashCode(); } }
static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm || term instanceof OrTerm) { SearchTerm[] terms; if (term instanceof AndTerm) terms = ((AndTerm)term).getTerms(); else terms = ((OrTerm)term).getTerms(); for (int i = 0; i < terms.length; i++) if (!isAscii(terms[i])) // outta here ! return false; } else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Equality comparison. */ public boolean equals(Object obj) { if (!(obj instanceof RecipientTerm)) return false; RecipientTerm rt = (RecipientTerm)obj; return rt.type.equals(this.type) && super.equals(obj); }
/** * The address comparator. * * @param msg The address comparison is applied to this Message * @return true if the comparison succeeds, otherwise false */ @Override public boolean match(Message msg) { Address[] from; try { from = msg.getFrom(); } catch (Exception e) { return false; } if (from == null) return false; for (int i=0; i < from.length; i++) if (super.match(from[i])) return true; return false; }
/** * Compute a hashCode for this object. */ @Override public int hashCode() { return type.hashCode() + super.hashCode(); } }
public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm || term instanceof OrTerm) { SearchTerm[] terms; if (term instanceof AndTerm) terms = ((AndTerm)term).getTerms(); else terms = ((OrTerm)term).getTerms(); for (int i = 0; i < terms.length; i++) if (!isAscii(terms[i])) // outta here ! return false; } else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Equality comparison. */ @Override public boolean equals(Object obj) { if (!(obj instanceof RecipientTerm)) return false; RecipientTerm rt = (RecipientTerm)obj; return rt.type.equals(this.type) && super.equals(obj); }
/** * The match method. * * @param msg The address match is applied to this Message's recepient * address * @return true if the match succeeds, otherwise false */ @Override public boolean match(Message msg) { Address[] recipients; try { recipients = msg.getRecipients(type); } catch (Exception e) { return false; } if (recipients == null) return false; for (int i=0; i < recipients.length; i++) if (super.match(recipients[i])) return true; return false; }
/** * Compute a hashCode for this object. */ public int hashCode() { return type.hashCode() + super.hashCode(); } }
/** * Check if the "text" terms in the given SearchTerm contain * non US-ASCII characters. * * @param term the search term * @return true if only ASCII */ public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm) return isAscii(((AndTerm)term).getTerms()); else if (term instanceof OrTerm) return isAscii(((OrTerm)term).getTerms()); else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Equality comparison. */ @Override public boolean equals(Object obj) { if (!(obj instanceof FromTerm)) return false; return super.equals(obj); } }
/** * The address comparator. * * @param msg The address comparison is applied to this Message * @return true if the comparison succeeds, otherwise false */ @Override public boolean match(Message msg) { Address[] from; try { from = msg.getFrom(); } catch (Exception e) { return false; } if (from == null) return false; for (int i=0; i < from.length; i++) if (super.match(from[i])) return true; return false; }
/** * Compute a hashCode for this object. */ public int hashCode() { return type.hashCode() + super.hashCode(); } }