public override bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash) { Ensure.NotNull(other, "why would we ever call this?"); //if (other == null) { // Fx.Assert("why would we ever call this?"); // return false; //} if (!ignoreTrailingSlash && (EndsWithSlash != other.EndsWithSlash)) { return(false); } return(other.Nature == UriTemplatePartType.Variable); }
public override bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash) { Ensure.NotNull(other, "why would we ever call this?"); //if (other == null) { // Fx.Assert("why would we ever call this?"); // return false; //} if (other.Nature != UriTemplatePartType.Literal) { return(false); } var otherAsLiteral = other as UriTemplateLiteralPathSegment; Ensure.NotNull(otherAsLiteral, "The nature requires that this will be OK"); return(IsMatch(otherAsLiteral, ignoreTrailingSlash)); }
public override bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash) { Ensure.NotNull(other, "why would we ever call this?"); //if (other == null) { // Fx.Assert("why would we ever call this?"); // return false; //} if (!ignoreTrailingSlash && (EndsWithSlash != other.EndsWithSlash)) { return(false); } var otherAsCompound = other as UriTemplateCompoundPathSegment; if (otherAsCompound == null) { // if other can't be cast as a compound then it can't be equivalent return(false); } if (_varLitPairs.Count != otherAsCompound._varLitPairs.Count) { return(false); } if (StringComparer.OrdinalIgnoreCase.Compare(_firstLiteral, otherAsCompound._firstLiteral) != 0) { return(false); } for (var pairIndex = 0; pairIndex < _varLitPairs.Count; pairIndex++) { if (StringComparer.OrdinalIgnoreCase.Compare(_varLitPairs[pairIndex].Literal, otherAsCompound._varLitPairs[pairIndex].Literal) != 0) { return(false); } } return(true); }
public abstract bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash);