/// <summary> /// Informs the mayìtcher about a new found value. /// </summary> /// <param name="key">The key.</param> /// <param name="newlyFoundValue">The new found value.</param> public override void Inform(string key, WalkList.WalkResult newlyFoundValue) { if (this.Verbose) { Logger.Info($"INFO : VARIABLE ({this.VariableName}): {key}"); Logger.Info($"NEED : VARIABLE ({this.VariableName}): {this.MatchExpression}"); } /* * We know the tree is parsed from left to right. * This is also the priority in the fields. * So we always use the first value we find. */ if (this.foundValue is null) { this.foundValue = newlyFoundValue; if (this.Verbose) { Logger.Info($"KEPT : VARIABLE ({this.VariableName}): {key}"); } if (this.interestedActions != null && this.interestedActions.Count != 0) { foreach (var action in this.interestedActions) { action.Inform(this.VariableName, newlyFoundValue.Value, newlyFoundValue.Tree); } } } }
/// <summary> /// The Inform. /// </summary> /// <param name="key">The key.</param> /// <param name="foundValue">Not used.</param> public override void Inform(string key, WalkList.WalkResult foundValue) { this.foundRequiredValue = true; if (this.Verbose) { Logger.Info($"Info REQUIRE: {key}"); Logger.Info($"NEED REQUIRE: {this.MatchExpression}"); Logger.Info($"KEPT REQUIRE: {key}"); } }
/// <summary> /// Informs when a new value is found. /// </summary> /// <param name="key">The key.</param> /// <param name="newlyFoundValue">The found value.</param> public override void Inform(string key, WalkList.WalkResult newlyFoundValue) { if (this.Verbose) { Logger.Info($"INFO : EXTRACT ({this.Attribute}): {key}"); Logger.Info($"NEED : EXTRACT ({this.Attribute}): {this.MatchExpression}"); } /* * We know the tree is parsed from left to right. * This is also the priority in the fields. * So we always use the first value we find. */ if (this.foundValue is null) { this.foundValue = newlyFoundValue.Value; if (this.Verbose) { Logger.Info($"KEPT : EXTRACT ({this.Attribute}): {key}"); } } }
/// <summary> /// Resets the matches. /// </summary> public override void Reset() { base.Reset(); this.foundValue = null; }