public PathEvaluatingTraversal(string dotNotation)
        {
            if ((dotNotation.Contains("*") && !dotNotation.Contains("\\*")) ||
                (dotNotation.Contains("$") && !dotNotation.Contains("\\$")))
            {
                throw new SpecException("DotNotation (write key) can not contain '*' or '$' : write key: " + dotNotation);
            }

            List <IPathElement> paths;
            Traversr            trav;

            if (!String.IsNullOrWhiteSpace(dotNotation))
            {
                // Compute the path elements.
                paths = PathElementBuilder.ParseDotNotationRHS(dotNotation);

                // Use the canonical versions of the path elements to create the Traversr
                var traversrPaths = new List <string>(paths.Count);
                foreach (IPathElement pe in paths)
                {
                    traversrPaths.Add(pe.GetCanonicalForm());
                }
                trav = CreateTraversr(traversrPaths);
            }
            else
            {
                paths = new List <IPathElement>();
                trav  = CreateTraversr(new List <string>(new[] { "" }));
            }

            var evalPaths = new List <IEvaluatablePathElement>(paths.Count);

            foreach (IPathElement pe in paths)
            {
                if (!(pe is IEvaluatablePathElement epe))
                {
                    throw new SpecException("RHS key=" + pe.RawKey + " is not a valid RHS key.");
                }

                evalPaths.Add(epe);
            }

            _elements = evalPaths.AsReadOnly();
            _traversr = trav;
        }
Example #2
0
 public MapTraversalStep(Traversr traversr, ITraversalStep child) :
     base(traversr, child)
 {
 }
Example #3
0
 public ArrayTraversalStep(Traversr traversr, ITraversalStep child) :
     base(traversr, child)
 {
 }
 public BaseTraversalStep(Traversr traversr, ITraversalStep child)
 {
     _traversr = traversr;
     _child    = child;
 }