public void IncreaseRefCount(EvalAuditStateNode current, PatternContext patternContext) { if (!_auditPatternInstance) { return; } _instanceCount.IncreaseRefCount( ChildNodes[0], current, _patternExpr, patternContext.StatementName, patternContext.EngineURI); }
internal static void WritePatternExpr(EvalAuditStateNode current, String patternExpression, TextWriter writer) { if (patternExpression != null) { writer.Write('('); writer.Write(patternExpression); writer.Write(')'); } else { TypeHelper.WriteInstance(writer, "subexr", current); } }
private String ToStringEvaluateFalse(EvalAuditStateNode current, String patternExpression, EvalStateNode fromNode) { var writer = new StringWriter(); WritePatternExpr(current, patternExpression, writer); writer.Write(" evaluate-false {"); writer.Write(" from "); TypeHelper.WriteInstance(writer, fromNode, false); writer.Write("}"); return(writer.ToString()); }
public void IncreaseRefCount(EvalFactoryNode evalNode, EvalAuditStateNode current, String patternExpr, String statementName, String engineURI) { int?count = _counts.Get(evalNode); if (count == null) { count = 1; } else { count++; } _counts.Put(evalNode, count); Print(current, patternExpr, engineURI, statementName, true, count); }
public void DecreaseRefCount(EvalFactoryNode evalNode, EvalAuditStateNode current, String patternExpr, String statementName, String engineURI) { int?count = _counts.Get(evalNode); if (count == null) { return; } count--; if (count <= 0) { _counts.Remove(evalNode); Print(current, patternExpr, engineURI, statementName, false, 0); return; } _counts.Put(evalNode, count); Print(current, patternExpr, engineURI, statementName, false, count); }
private static void Print(EvalAuditStateNode current, String patternExpression, String engineURI, String statementName, bool added, int?count) { if (!AuditPath.IsAuditEnabled) { return; } var writer = new StringWriter(); EvalAuditStateNode.WritePatternExpr(current, patternExpression, writer); if (added) { writer.Write(" increased to " + count); } else { writer.Write(" decreased to " + count); } AuditPath.AuditLog(engineURI, statementName, AuditEnum.PATTERNINSTANCES, writer.ToString()); }
private static String ToStringEvaluateTrue(EvalAuditStateNode current, String patternExpression, MatchedEventMap matchEvent, EvalStateNode fromNode, bool isQuitted) { var writer = new StringWriter(); WritePatternExpr(current, patternExpression, writer); writer.Write(" evaluate-true {"); writer.Write(" from: "); TypeHelper.WriteInstance(writer, fromNode, false); writer.Write(" map: {"); var delimiter = ""; var data = matchEvent.MatchingEvents; for (int i = 0; i < data.Length; i++) { var name = matchEvent.Meta.TagsPerIndex[i]; var value = matchEvent.GetMatchingEventAsObject(i); writer.Write(delimiter); writer.Write(name); writer.Write("="); if (value is EventBean) { writer.Write(((EventBean)value).Underlying.ToString()); } else if (value is EventBean[]) { writer.Write(EventBeanUtility.Summarize((EventBean[])value)); } delimiter = ", "; } writer.Write("} quitted: "); writer.Write(isQuitted); writer.Write("}"); return(writer.ToString()); }