public override void Start(MatchedEventMap beginState) { AgentInstanceContext agentInstanceContext = evalEveryNode.Context.AgentInstanceContext; agentInstanceContext.InstrumentationProvider.QPatternEveryStart(evalEveryNode.factoryNode, beginState); agentInstanceContext.AuditProvider.PatternInstance(true, evalEveryNode.factoryNode, agentInstanceContext); this.beginState = beginState.ShallowCopy(); EvalStateNode childState = evalEveryNode.ChildNode.NewState(this); spawnedNodes.Add(childState); // During the start of the child we need to use the temporary evaluator to catch any event created during a start. // Events created during the start would likely come from the "not" operator. // Quit the new child again if var spawnEvaluator = new EvalEveryStateSpawnEvaluator(evalEveryNode.Context.StatementName); childState.ParentEvaluator = spawnEvaluator; childState.Start(beginState); // If the spawned expression turned true already, just quit it if (spawnEvaluator.IsEvaluatedTrue) { childState.Quit(); } else { childState.ParentEvaluator = this; } agentInstanceContext.InstrumentationProvider.APatternEveryStart(); }
public void EvaluateTrue( MatchedEventMap matchEvent, EvalStateNode fromNode, bool isQuitted, EventBean optionalTriggeringEvent) { AgentInstanceContext agentInstanceContext = evalEveryNode.Context.AgentInstanceContext; agentInstanceContext.InstrumentationProvider.QPatternEveryEvaluateTrue( evalEveryNode.factoryNode, matchEvent); if (isQuitted) { spawnedNodes.Remove(fromNode); } // See explanation in EvalFilterStateNode for the type check if (fromNode.IsFilterStateNode || fromNode.IsObserverStateNodeNonRestarting) { // We do not need to newState new listeners here, since the filter state node below this node did not quit } else { // Spawn all nodes below this EVERY node // During the start of a child we need to use the temporary evaluator to catch any event created during a start // Such events can be raised when the "not" operator is used. var spawnEvaluator = new EvalEveryStateSpawnEvaluator(evalEveryNode.Context.StatementName); EvalStateNode spawned = evalEveryNode.ChildNode.NewState(spawnEvaluator); spawned.Start(beginState); // If the whole spawned expression already turned true, quit it again if (spawnEvaluator.IsEvaluatedTrue) { spawned.Quit(); } else { spawnedNodes.Add(spawned); spawned.ParentEvaluator = this; } } // All nodes indicate to their parents that their child node did not quit, therefore a false for isQuitted agentInstanceContext.AuditProvider.PatternTrue( evalEveryNode.FactoryNode, this, matchEvent, false, agentInstanceContext); ParentEvaluator.EvaluateTrue(matchEvent, this, false, optionalTriggeringEvent); agentInstanceContext.InstrumentationProvider.APatternEveryEvaluateTrue(); }
public void EvaluateFalse( EvalStateNode fromNode, bool restartable) { AgentInstanceContext agentInstanceContext = evalEveryNode.Context.AgentInstanceContext; agentInstanceContext.InstrumentationProvider.QPatternEveryEvalFalse(evalEveryNode.factoryNode); fromNode.Quit(); spawnedNodes.Remove(fromNode); if (!restartable) { agentInstanceContext.AuditProvider.PatternFalse(evalEveryNode.FactoryNode, this, agentInstanceContext); agentInstanceContext.AuditProvider.PatternInstance( false, evalEveryNode.factoryNode, agentInstanceContext); ParentEvaluator.EvaluateFalse(this, false); return; } // Spawn all nodes below this EVERY node // During the start of a child we need to use the temporary evaluator to catch any event created during a start // Such events can be raised when the "not" operator is used. var spawnEvaluator = new EvalEveryStateSpawnEvaluator(evalEveryNode.Context.StatementName); EvalStateNode spawned = evalEveryNode.ChildNode.NewState(spawnEvaluator); spawned.Start(beginState); // If the whole spawned expression already turned true, quit it again if (spawnEvaluator.IsEvaluatedTrue) { spawned.Quit(); } else { spawnedNodes.Add(spawned); spawned.ParentEvaluator = this; } agentInstanceContext.InstrumentationProvider.APatternEveryEvalFalse(); }