Ejemplo n.º 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)
            {
                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);
            }
            else
            {
                for (; inspector.Index < inspector.Length; inspector.Index++)
                {
                    var child = inspector.Current;

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

            return(true);
        }
Ejemplo n.º 5
0
 public override Boolean Check(NodeInspector inspector)
 {
     inspector.Index = inspector.Length;
     return(true);
 }
        /// <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);
        }
Ejemplo n.º 7
0
 public override Boolean Check(NodeInspector inspector)
 {
     return(inspector.Length == 0);
 }
Ejemplo n.º 8
0
 public abstract Boolean Check(NodeInspector inspector);