/** Match with a template. * Match only the response class if the last two digits of the * match templates are 0's */ public boolean match(Object matchObj) { if (!(matchObj instanceof StatusLine)) return false; StatusLine sl = (StatusLine) matchObj; // A pattern matcher has been registered. if (sl.matchExpression != null) return sl.matchExpression.match(this.encode()); // no patter matcher has been registered.. if (sl.sipVersion != null && !sl.sipVersion.equals(sipVersion)) return false; if (sl.statusCode != 0) { if (matchStatusClass) { int hiscode = sl.statusCode; String codeString = Integer.toString(sl.statusCode); String mycode = Integer.toString(statusCode); if (codeString.charAt(0) != mycode.charAt(0)) return false; } else { if (statusCode != sl.statusCode) return false; } } if (sl.reasonPhrase == null || reasonPhrase == sl.reasonPhrase) return true; return reasonPhrase.equals(sl.reasonPhrase); }
&& ((GenericObject) hisObj).getMatcher() != null) { String myObjEncoded = ((GenericObject) myObj).encode(); return ((GenericObject) hisObj).getMatcher().match( myObjEncoded); } else if (
((GenericObject) myObj).encode(); boolean retval = ((GenericObject) hisObj).getMatcher().match( myObjEncoded); if (!retval)
((GenericObject) myObj).encode(); boolean retval = ((GenericObject) hisObj).getMatcher().match( myObjEncoded); if (!retval)
/** Match on the address only. * Dont care about the display name. */ public boolean match(Object other) { // TODO -- add the matcher; if (other == null) return true; if (!(other instanceof Address)) return false; else { AddressImpl that = (AddressImpl) other; if (that.getMatcher() != null) return that.getMatcher().match(this.encode()); else if (that.displayName != null && this.displayName == null) return false; else if (that.displayName == null) return address.match(that.address); else return displayName.equalsIgnoreCase(that.displayName) && address.match(that.address); } }