public void EvaluateFalse(EvalStateNode fromNode, bool restartable) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QPatternEveryDistinctEvalFalse(EveryDistinctNode); } fromNode.Quit(); SpawnedNodes.Remove(fromNode); // 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(EveryDistinctNode.Context.PatternContext.StatementName); var spawned = EveryDistinctNode.ChildNode.NewState(spawnEvaluator, null, 0L); spawned.Start(BeginState); // If the whole spawned expression already turned true, quit it again if (spawnEvaluator.IsEvaluatedTrue) { spawned.Quit(); } else { SpawnedNodes.Put(spawned, new HashSet <Object>()); spawned.ParentEvaluator = this; } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().APatternEveryDistinctEvalFalse(); } }
public void EvaluateFalse(EvalStateNode fromNode, bool restartable) { int index; fromNode.Quit(); var hasIndex = Nodes.TryGetValue(fromNode, out index); Nodes.Remove(fromNode); if (hasIndex && index > 0) { if (EvalFollowedByNode.IsTrackWithMax) { CountActivePerChild[index - 1]--; } if (EvalFollowedByNode.IsTrackWithPool) { PatternSubexpressionPoolStmtSvc poolSvc = EvalFollowedByNode.Context.StatementContext.PatternSubexpressionPoolSvc; poolSvc.EngineSvc.DecreaseCount(EvalFollowedByNode, EvalFollowedByNode.Context.AgentInstanceContext); poolSvc.StmtHandler.DecreaseCount(); } } if (Nodes.IsEmpty()) { ParentEvaluator.EvaluateFalse(this, true); Quit(); } }
public override void Quit() { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QPatternRootQuit(); } if (_topStateNode != null) { _topStateNode.Quit(); HandleQuitEvent(); } _topStateNode = null; if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().APatternRootQuit(); } }
public override void Quit() { if (_childState != null) { _childState.Quit(); } _evalAuditNode.FactoryNode.DecreaseRefCount(this, _evalAuditNode.Context.PatternContext); }
public void EvaluateFalse(EvalStateNode fromNode, bool restartable) { Instrument.With( i => i.QPatternMatchUntilEvalFalse(_evalMatchUntilNode, fromNode == _stateUntil), i => i.APatternMatchUntilEvalFalse(), () => { var isMatcher = fromNode == _stateMatcher; if (isMatcher) { _stateMatcher.Quit(); _stateMatcher = null; } else { _stateUntil.Quit(); _stateUntil = null; } ParentEvaluator.EvaluateFalse(this, true); }); }
public override void Quit() { if (_activeChildNode == null) { return; } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QPatternGuardQuit(_evalGuardNode); } if (_activeChildNode != null) { _activeChildNode.Quit(); _guard.StopGuard(); } _activeChildNode = null; if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().APatternGuardQuit(); } }
public override void Quit() { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QPatternNotQuit(_evalNotNode); } if (_childNode != null) { _childNode.Quit(); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().APatternNotQuit(); } }
public void EvaluateFalse(EvalStateNode fromNode, bool restartable) { Instrument.With( i => i.QPatternFollowedByEvalFalse(EvalFollowedByNode), i => i.APatternFollowedByEvalFalse(), () => { fromNode.Quit(); Nodes.Remove(fromNode); if (Nodes.IsEmpty()) { ParentEvaluator.EvaluateFalse(this, true); QuitInternal(); } }); }
public void EvaluateTrue(MatchedEventMap matchEvent, EvalStateNode fromNode, bool isQuitted) { Instrument.With( i => i.QPatternMatchUntilEvaluateTrue(_evalMatchUntilNode, matchEvent, fromNode == _stateUntil), i => i.APatternMatchUntilEvaluateTrue(_stateMatcher == null && _stateUntil == null), () => { bool isMatcher = false; if (fromNode == _stateMatcher) { // Add the additional tagged events to the list for later posting isMatcher = true; _numMatches++; int[] tags = _evalMatchUntilNode.FactoryNode.TagsArrayed; for (int i = 0; i < tags.Length; i++) { var theEvent = matchEvent.GetMatchingEventAsObject(tags[i]); if (theEvent != null) { if (_matchedEventArrays[i] == null) { _matchedEventArrays[i] = new List <EventBean>(); } if (theEvent is EventBean) { _matchedEventArrays[i].Add((EventBean)theEvent); } else { EventBean[] arrayEvents = (EventBean[])theEvent; _matchedEventArrays[i].AddAll(arrayEvents); } } } } if (isQuitted) { if (isMatcher) { _stateMatcher = null; } else { _stateUntil = null; } } // handle matcher evaluating true if (isMatcher) { if ((IsTightlyBound) && (_numMatches == _lowerbounds)) { QuitInternal(); MatchedEventMap consolidated = Consolidate( matchEvent, _matchedEventArrays, _evalMatchUntilNode.FactoryNode.TagsArrayed); ParentEvaluator.EvaluateTrue(consolidated, this, true); } else { // restart or keep started if not bounded, or not upper bounds, or upper bounds not reached bool restart = (!IsBounded) || (_upperbounds == null) || (_upperbounds > _numMatches); if (_stateMatcher == null) { if (restart) { EvalNode childMatcher = _evalMatchUntilNode.ChildNodeSub; _stateMatcher = childMatcher.NewState(this, null, 0L); _stateMatcher.Start(_beginState); } } else { if (!restart) { _stateMatcher.Quit(); _stateMatcher = null; } } } } else // handle until-node { QuitInternal(); // consolidate multiple matched events into a single event MatchedEventMap consolidated = Consolidate( matchEvent, _matchedEventArrays, _evalMatchUntilNode.FactoryNode.TagsArrayed); if ((_lowerbounds != null) && (_numMatches < _lowerbounds)) { ParentEvaluator.EvaluateFalse(this, true); } else { ParentEvaluator.EvaluateTrue(consolidated, this, true); } } }); }