Beispiel #1
0
        /// <summary>
        /// Checks this Uri matches with the provided Uri.
        /// </summary>
        /// <param name="other">the other uri</param>
        /// <returns>true if matches, false otherwise</returns>
        public bool IsSame(ARMUri other)
        {
            var thisUriItr  = this.GetEnumerator();
            var otherUriItr = other.GetEnumerator();

            //
            while (thisUriItr.MoveNext() && otherUriItr.MoveNext())
            {
                if (thisUriItr.Current is PositionalSegment)
                {
                    if (otherUriItr.Current is PositionalSegment)
                    {
                        continue;
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (thisUriItr.Current is ParentSegment)
                {
                    if (otherUriItr.Current is ParentSegment)
                    {
                        if (thisUriItr.Current.Name.EqualsIgnoreCase(otherUriItr.Current.Name))
                        {
                            continue;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (thisUriItr.Current is ReferenceSegment)
                {
                    if (otherUriItr.Current is ReferenceSegment)
                    {
                        if (thisUriItr.Current.Name.EqualsIgnoreCase(otherUriItr.Current.Name))
                        {
                            continue;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (thisUriItr.Current is TerminalSegment)
                {
                    if (otherUriItr.Current is TerminalSegment)
                    {
                        if (thisUriItr.Current.Name.EqualsIgnoreCase(otherUriItr.Current.Name))
                        {
                            continue;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(thisUriItr.MoveNext() == false &&
                   otherUriItr.MoveNext() == false);
        }