Пример #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);
        }
        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;
        }
        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);
        }
        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;
        }
        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;
        }
        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;
        }
        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);
        }
        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);
        }
 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;
 }
 public abstract Boolean Check(NodeInspector inspector);
 public override Boolean Check(NodeInspector inspector)
 {
     inspector.Index = inspector.Length;
     return true;
 }
 public override Boolean Check(NodeInspector inspector)
 {
     inspector.Index = inspector.Length;
     return(true);
 }