コード例 #1
0
ファイル: XPathPathExpr.cs プロジェクト: amasasi/DotNetRosa
        public override bool Equals(System.Object o)
        {
            if (o is XPathPathExpr)
            {
                XPathPathExpr x = (XPathPathExpr)o;

                //Shortcuts for easily comparable values
                if (init_context != x.init_context || steps.Length != x.steps.Length)
                {
                    return(false);
                }

                return(ExtUtil.arrayEquals(steps, x.steps) && (init_context == INIT_CONTEXT_EXPR?filtExpr.Equals(x.filtExpr):true));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: XPathStep.cs プロジェクト: amasasi/DotNetRosa
        /// <summary> "matches" follows roughly the same process as equals(), in that it for a step it will
        /// check whether two steps share the same properties (multiplicity, test, axis, etc).
        /// The only difference is that match() will allow for a named step to match a step who's name
        /// is a wildcard.
        ///
        /// So
        /// \/path\/
        /// will "match"
        /// \/*\/
        ///
        /// even though they are not equal.
        ///
        /// Matching is reflexive, consistent, and symmetric, but _not_ transitive.
        /// </summary>
        /// <param name="xPathStep">
        /// </param>
        /// <returns>
        /// </returns>
        protected internal virtual bool matches(XPathStep o)
        {
            if (o is XPathStep)
            {
                XPathStep x = (XPathStep)o;

                //shortcuts for faster evaluation
                if (axis != x.axis || (test != x.test && !((x.test == TEST_NAME && this.test == TEST_NAME_WILDCARD) || (this.test == TEST_NAME && x.test == TEST_NAME_WILDCARD))) || predicates.Length != x.predicates.Length)
                {
                    return(false);
                }

                switch (test)
                {
                case TEST_NAME:  if (x.test != TEST_NAME_WILDCARD && !name.Equals(x.name))
                    {
                        return(false);
                    }
                    break;

                case TEST_NAMESPACE_WILDCARD:  if (!namespace_Renamed.Equals(x.namespace_Renamed))
                    {
                        return(false);
                    }
                    break;

                case TEST_TYPE_PROCESSING_INSTRUCTION:  if (!ExtUtil.equals(literal, x.literal))
                    {
                        return(false);
                    }
                    break;

                default:  break;
                }

                return(ExtUtil.arrayEquals(predicates, x.predicates));
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: XPathStep.cs プロジェクト: amasasi/DotNetRosa
        public override bool Equals(System.Object o)
        {
            if (o is XPathStep)
            {
                XPathStep x = (XPathStep)o;

                //shortcuts for faster evaluation
                if (axis != x.axis || test != x.test || predicates.Length != x.predicates.Length)
                {
                    return(false);
                }

                switch (test)
                {
                case TEST_NAME:  if (!name.Equals(x.name))
                    {
                        return(false);
                    }
                    break;

                case TEST_NAMESPACE_WILDCARD:  if (!namespace_Renamed.Equals(x.namespace_Renamed))
                    {
                        return(false);
                    }
                    break;

                case TEST_TYPE_PROCESSING_INSTRUCTION:  if (!ExtUtil.equals(literal, x.literal))
                    {
                        return(false);
                    }
                    break;

                default:  break;
                }

                return(ExtUtil.arrayEquals(predicates, x.predicates));
            }
            else
            {
                return(false);
            }
        }