コード例 #1
0
        public override Boolean Check(NodeInspector inspector)
        {
            var min   = _quantifier == ElementQuantifier.ZeroOrMore || _quantifier == ElementQuantifier.ZeroOrOne ? 0 : 1;
            var max   = _quantifier == ElementQuantifier.One || _quantifier == ElementQuantifier.ZeroOrOne ? 1 : Int32.MaxValue;
            var found = 0;

            while (found < max && !inspector.IsCompleted)
            {
                var missed   = false;
                var previous = inspector.Index;

                foreach (var child in _children)
                {
                    if (!child.Check(inspector))
                    {
                        missed = true;
                        break;
                    }
                }

                if (missed)
                {
                    inspector.Index = previous;
                    break;
                }

                found++;
            }

            return(found >= min);
        }
コード例 #2
0
        public override Boolean Check(NodeInspector inspector)
        {
            var min = _quantifier == ElementQuantifier.ZeroOrMore || _quantifier == ElementQuantifier.ZeroOrOne ? 0 : 1;
            var max = _quantifier == ElementQuantifier.One || _quantifier == ElementQuantifier.ZeroOrOne ? 1 : Int32.MaxValue;
            var found = 0;

            while (found < max && !inspector.IsCompleted)
            {
                var hit = false;

                foreach (var choice in _children)
                {
                    var previous = inspector.Index;

                    if (choice.Check(inspector))
                    {
                        hit = true;
                        break;
                    }

                    inspector.Index = previous;
                }

                if (hit)
                    found++;
                else
                    break;
            }

            return found >= min;
        }
コード例 #3
0
        public override Boolean Check(NodeInspector inspector)
        {
            var min   = _quantifier == ElementQuantifier.ZeroOrMore || _quantifier == ElementQuantifier.ZeroOrOne ? 0 : 1;
            var max   = _quantifier == ElementQuantifier.One || _quantifier == ElementQuantifier.ZeroOrOne ? 1 : Int32.MaxValue;
            var found = 0;

            while (found < max && !inspector.IsCompleted)
            {
                var hit = false;

                foreach (var choice in _children)
                {
                    var previous = inspector.Index;

                    if (choice.Check(inspector))
                    {
                        hit = true;
                        break;
                    }

                    inspector.Index = previous;
                }

                if (hit)
                {
                    found++;
                }
                else
                {
                    break;
                }
            }

            return(found >= min);
        }
コード例 #4
0
        public override Boolean Check(NodeInspector inspector)
        {
            var min = _quantifier == ElementQuantifier.ZeroOrMore || _quantifier == ElementQuantifier.ZeroOrOne ? 0 : 1;
            var max = _quantifier == ElementQuantifier.One || _quantifier == ElementQuantifier.ZeroOrOne ? 1 : Int32.MaxValue;
            var found = 0;

            while (found < max && !inspector.IsCompleted)
            {
                var missed = false;
                var previous = inspector.Index;

                foreach (var child in _children)
                {
                    if (!child.Check(inspector))
                    {
                        missed = true;
                        break;
                    }
                }

                if (missed)
                {
                    inspector.Index = previous;
                    break;
                }

                found++;
            }

            return found >= min;
        }
コード例 #5
0
        public override Boolean Check(NodeInspector inspector)
        {
            if (_quantifier == ElementQuantifier.One && inspector.Length > 1)
                return false;

            for (; inspector.Index < inspector.Length; inspector.Index++)
            {
                var child = inspector.Current;

                if (child is Element && !_names.Contains(child.NodeName))
                    return false;
            }

            return true;
        }
コード例 #6
0
        public override Boolean Check(NodeInspector inspector)
        {
            var min = _quantifier == ElementQuantifier.ZeroOrMore || _quantifier == ElementQuantifier.ZeroOrOne ? 0 : 1;
            var max = _quantifier == ElementQuantifier.One || _quantifier == ElementQuantifier.ZeroOrOne ? 1 : Int32.MaxValue;
            var found = 0;

            while (found < max && !inspector.IsCompleted)
            {
                if (inspector.Current.NodeName != Name)
                    break;

                inspector.Index++;
                found++;
            }

            return found >= min;
        }
コード例 #7
0
        public override Boolean Check(NodeInspector inspector)
        {
            if (_quantifier == ElementQuantifier.One && inspector.Length > 1)
            {
                return(false);
            }

            for (; inspector.Index < inspector.Length; inspector.Index++)
            {
                var child = inspector.Current;

                if (child is Element && !_names.Contains(child.NodeName))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #8
0
        public override Boolean Check(NodeInspector inspector)
        {
            var min   = _quantifier == ElementQuantifier.ZeroOrMore || _quantifier == ElementQuantifier.ZeroOrOne ? 0 : 1;
            var max   = _quantifier == ElementQuantifier.One || _quantifier == ElementQuantifier.ZeroOrOne ? 1 : Int32.MaxValue;
            var found = 0;

            while (found < max && !inspector.IsCompleted)
            {
                if (inspector.Current.NodeName != Name)
                {
                    break;
                }

                inspector.Index++;
                found++;
            }

            return(found >= min);
        }
コード例 #9
0
        /// <summary>
        /// Checks the element.
        /// </summary>
        /// <param name="element">The element to check.</param>
        /// <returns>True if everything is according to the definition, otherwise false.</returns>
        public Boolean Check(Element element)
        {
            var inspector = new NodeInspector(element);

            return(Entry.Check(inspector) && inspector.IsCompleted);
        }
コード例 #10
0
 public override Boolean Check(NodeInspector inspector)
 {
     return inspector.Length == 0;
 }
コード例 #11
0
 public abstract Boolean Check(NodeInspector inspector);
コード例 #12
0
 public override Boolean Check(NodeInspector inspector)
 {
     return(inspector.Length == 0);
 }
コード例 #13
0
 /// <summary>
 /// Checks the element.
 /// </summary>
 /// <param name="element">The element to check.</param>
 /// <returns>True if everything is according to the definition, otherwise false.</returns>
 public Boolean Check(Element element)
 {
     var inspector = new NodeInspector(element);
     return Entry.Check(inspector) && inspector.IsCompleted;
 }
コード例 #14
0
 public abstract Boolean Check(NodeInspector inspector);
コード例 #15
0
 public override Boolean Check(NodeInspector inspector)
 {
     inspector.Index = inspector.Length;
     return true;
 }
コード例 #16
0
 public override Boolean Check(NodeInspector inspector)
 {
     inspector.Index = inspector.Length;
     return(true);
 }