using System;
namespace AnticipatingMinds.CodeInsight{
/// <summary>
/// Represents a set of possible aggregation styles.
/// </summary>
public enum MetricAggregationType
{
/// <summary>
/// Aggregate values and calculate their average.
/// </summary>
Average,
/// <summary>
/// Aggregate values and calculate their min.
/// </summary>
Min,
/// <summary>
/// Aggregate values and calculate their max.
/// </summary>
Max,
/// <summary>
/// Aggregate values and calculate their sum.
/// </summary>
Sum
}
/// <summary>
/// Defines levels of aggregation.
/// </summary>
[Flags]
public enum MetricAggregationLevel
{
/// <summary>
/// Aggregate metric on all applicable levels.
/// </summary>
All = 0xff,
/// <summary>
/// Metric is aggregated on the solution metrics level.
/// </summary>
CodeSolution = 0x10,
/// <summary>
/// Metric is aggregated on the assembly metrics level.
/// </summary>
Assembly = 0x08,
/// <summary>
/// Metric is aggregated on the type declaration metrics level.
/// </summary>
TypeDeclaration = 0x04,
/// <summary>
/// Metric is aggregated on the type member metrics level.
/// </summary>
TypeMemberDeclaration = 0x02
}
/// <summary>
/// Represents an aggregated metric.
/// </summary>
/// <remarks>
/// Aggregated metrics is an easy way to add aggregation to an existing metric.
/// </remarks>
public abstract class CodeAggregateMetric : CodeMetric
{
public CodeAggregateMetric(CodeMetric aggregatedMetric,MetricAggregationType aggregationType)
{
this.aggregationType = aggregationType;
this.aggregatedMetric = aggregatedMetric;
}
/// <summary>
/// Gets a metric aggregation style.
/// </summary>
public MetricAggregationType AggregationType
{
get
{
return aggregationType;
}
}
/// <summary>
/// Gets a set of levels on which aggregated metric is added
/// </summary>
public virtual MetricAggregationLevel AggregationLevels
{
get
{
return MetricAggregationLevel.All;
}
}
/// <summary>
/// Gets a metric being aggregated.
/// </summary>
public CodeMetric AggregatedMetric
{
get
{
return aggregatedMetric;
}
}
private MetricAggregationType aggregationType;
private CodeMetric aggregatedMetric;
}
}
|