private string NonBinaryCriterionString(Criterion criterion) { if (criterion.GetType() == typeof(EqualCriterion)) { return($"{((EqualCriterion)criterion).Col} = '{((EqualCriterion)criterion).Value}'"); } if (criterion.GetType() == typeof(LikeCriterion)) { return($"{((LikeCriterion)criterion).Col} like '{((LikeCriterion)criterion).Value}%'"); } return(criterion.ToString()); }
public override IValue GetValueFor(Criterion criterion) { if (criterion == SamplingCriteriaContext.TopStackOccurrenceCriterion) { return(_topStackOccurrence); } if (criterion == SamplingCriteriaContext.DurationCriterion) { return(_duration); } string message = string.Format("Criterion {0} is not supported for a tracing method", criterion.GetType().Name); throw new ArgumentException(message); }
public IList <Material> Retrieve(string[] cols, string tbl, Criterion criterion) { var sql = "select "; var cs = ""; var i = 0; while (i < cols.Length) { if (cs.Any()) { cs = "" + cs + ", "; } var c = cols[i++]; cs = cs + c.ToString(); } sql += cs; sql += " " + "from"; sql = sql + " " + tbl; if (criterion != null) { sql += " where "; } sql += " "; Criterion lhs, rhs; while (criterion != null) { if (criterion.GetType() == typeof(AndCriterion)) { lhs = ((AndCriterion)criterion).Lhs; rhs = ((AndCriterion)criterion).Rhs; sql = sql + $" { NonBinaryCriterionString(lhs).ToString() } " + $"and { NonBinaryCriterionString(rhs).ToString() }"; } else { sql += NonBinaryCriterionString(criterion); } criterion = null; } //sql = sql + criterion.ToString(); return(Database.SelectMany(sql)); }
public IValue GetMaxValueFor(Criterion criterion) { if (criterion == CallCountCriterion) { return(_maxCallCount); } if (criterion == TimeWallClockCriterion) { return(_maxTimeWallClock); } if (criterion == TimeActiveCriterion) { return(_maxTimeActive); } var exceptionMessage = string.Format("Criterion of type {0} is not available in {1}", criterion.GetType().Name, this.GetType().Name); throw new ArgumentException(exceptionMessage); }
public IValue GetMaxValueFor(Criterion criterion) { if (criterion == TopStackOccurrenceCriterion) { return(_maxTopStackOccurrence); } if (criterion == DurationCriterion) { return(_maxDuration); } var exceptionMessage = string.Format("Criterion of type {0} is not available in {1}", criterion.GetType().Name, this.GetType().Name); throw new ArgumentException(exceptionMessage); }
public override IValue GetValueFor(Criterion criterion) { if (criterion == TracingCriteriaContext.CallCountCriterion) { return(_callCountValue); } if (criterion == TracingCriteriaContext.TimeWallClockCriterion) { return(_timeWallClockValue); } if (criterion == TracingCriteriaContext.TimeActiveCriterion) { return(_timeActiveValue); } string message = string.Format("Criterion {0} is not supported for a tracing method", criterion.GetType().Name); throw new ArgumentException(message); }