Example #1
0
 private Selector(string query, Element root)
 {
     Validate.NotNull(query);
     query = query.Trim();
     Validate.NotEmpty(query);
     Validate.NotNull(root);
     this.evaluator = QueryParser.Parse(query);
     this.root = root;
 }
Example #2
0
 /// <summary>
 /// Build a list of elements,
 /// by visiting root and every descendant of root, and testing it against the evaluator.
 /// </summary>
 /// <param name="eval">Evaluator to test elements against</param>
 /// <param name="root">root of tree to descend</param>
 /// <returns>list of matches; empty if none</returns>
 public static Elements Collect(Evaluator eval, Element root)
 {
     Elements elements = new Elements();
     new NodeTraversor(new Collector.Accumulator(root, elements, eval)).Traverse(root);
     return elements;
 }
Example #3
0
 internal Accumulator(Element root, Elements elements, Evaluator eval)
 {
     this.root = root;
     this.elements = elements;
     this.eval = eval;
 }
Example #4
0
 public Parent(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #5
0
 public ImmediateParent(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #6
0
 public ImmediatePreviousSibling(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #7
0
 public Not(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #8
0
 public PreviousSibling(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #9
0
 public ImmediatePreviousSibling(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #10
0
 public ImmediateParent(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #11
0
 internal Accumulator(Element root, Elements elements, Evaluator eval)
 {
     this.root     = root;
     this.elements = elements;
     this.eval     = eval;
 }
Example #12
0
 public Parent(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #13
0
 public Not(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #14
0
 public Has(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #15
0
 internal void ReplaceRightMostEvaluator(Evaluator replacement)
 {
     evaluators[num - 1] = replacement;
 }
Example #16
0
 public Has(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }
Example #17
0
 public void Add(Evaluator e)
 {
     evaluators.Add(e);
     UpdateNumEvaluators();
 }
Example #18
0
 public PreviousSibling(Evaluator evaluator)
 {
     this.evaluator = evaluator;
 }