public WarningContext(WarningContext.ContextType type) : this(type, 0) { }
public OutcomeContext AddNewOutcomeContext(Outcome outcome, WarningContext warningContext) { Contract.Requires(outcome != null); Contract.Ensures(Contract.Result<OutcomeContext>() != null); throw new NotImplementedException(); }
public WarningContext(WarningContext.ContextType type, int associatedNumericalinfo) { this.Type = type; this.AssociatedInfo = associatedNumericalinfo; this.Name = null; }
public WarningContext(WarningContext.ContextType type, string varName) : this(type, 0) { this.Name = varName; }
public OutcomeContext AddNewOutcomeContext(Outcome outcome, WarningContext context) { if (!this.IsValid) return null; var result = this.model.NewOutcomeContext(outcome); result.WarningContext = context; return result; }
public void AddWarningContext(WarningContext context) { this.Context.Add(context); }
private double ComputeScoreForInferredCalleeAssume(WarningContext.CalleeInfo calleeInfo) { var result = ScoreInferredCalleeAssume; // Using reflection, there are too many cases (26?) to consider, and we may add more in the future... var thisFields = typeof(WarningScoresManager).GetFields(BindingFlags.Instance | BindingFlags.NonPublic) .Where(f => f.Name.StartsWith(ScoreCalleeAssumeExtraInfo)) .ToArray(); // Use ToArray to force the evaluation foreach (var enumFlag in Enum.GetValues(typeof(WarningContext.CalleeInfo)).Cast<WarningContext.CalleeInfo>()) { if (calleeInfo.HasFlag(enumFlag)) { var fieldName = ScoreCalleeAssumeExtraInfo + enumFlag.ToString(); var field = thisFields.Where(f => f.Name == fieldName).FirstOrDefault(); if (field != null) // Sanity check, should never happen { var score = (double)field.GetValue(this); result *= score; } else { Contract.Assume(false, "Should never happen"); } } } return result; }
static private bool ContainsWarningContext(Witness witness, WarningContext.ContextType what) { return witness.Context.Any(wc => wc.Type == what); }
public OutcomeContext AddNewOutcomeContext(Outcome outcome, WarningContext warningContext) { return underlying.AddNewOutcomeContext(outcome, warningContext); }