예제 #1
0
 /**
  * <p>Adds static source (<b>SDEF</b>). Static sources are the result of a consolidation function applied
  * to *any* other source that has been defined previously.</p>
  *
  * @param name      source name.
  * @param defName   Name of the datasource to calculate the value from.
  * @param consolFun Consolidation function to use for value calculation
  */
 public void addDatasource(String name, String defName, AggregateFunction.Type aggregateFunction)
 {
    sources.Add(new DatatSDef(name, defName, aggregateFunction));
 }
예제 #2
0
 public long getTimeStamp(AggregateFunction.Type aggregateFunction)
 {
    switch (aggregateFunction)
    {
       case AggregateFunction.Type.AVERAGE:
          return LastTimeStamp;
       case AggregateFunction.Type.FIRST:
          return FirstTimeStamp;
       case AggregateFunction.Type.LAST:
          return LastTimeStamp;
       case AggregateFunction.Type.MAX:
          return MaxTimeStamp;
       case AggregateFunction.Type.MIN:
          return MinTimeStamp;
       case AggregateFunction.Type.TOTAL:
          return LastTimeStamp;
    }
    throw new ArgumentException("Unknown aggregate function: " + aggregateFunction);
 }
예제 #3
0
 /**
  * Creates a new (static) virtual datasouce. The value of the datasource is constant. This value is
  * evaluated by applying the given consolidation function to another virtual datasource.
  *
  * @param name      Source name
  * @param defName   Other source name
  * @param consolFun Consolidation function to be applied to other datasource.
  */
 public void datasource(String name, String defName, AggregateFunction.Type function)
 {
    sources.Add(new SDef(name, defName, function));
 }
예제 #4
0
 /**
  * Returns single aggregated value for the give consolidation function
  *
  * @param aggregateFunction Aggregate function: MIN, MAX, FIRST, LAST, AVERAGE, TOTAL. These constanst
  *                  are conveniently defined in the {@link rrd4n.Common.AggregateFunction ConsolFun} interface.
  *
  * @return Aggregated value
  *
  * @throws ArgumentException Thrown if unsupported consolidation function is supplied
  */
 public double getAggregate(AggregateFunction.Type aggregateFunction)
 {
    switch (aggregateFunction)
    {
       case AggregateFunction.Type.AVERAGE:
             return average;
       case AggregateFunction.Type.FIRST:
             return first;
       case AggregateFunction.Type.LAST:
             return last;
       case AggregateFunction.Type.MAX:
             return max;
       case AggregateFunction.Type.MIN:
             return min;
       case AggregateFunction.Type.TOTAL:
             return total;
     }
    throw new ArgumentException("Unknown aggregate function: " + aggregateFunction);
 }
예제 #5
0
파일: DatatSDef.cs 프로젝트: mujing/rrd4net
 public DatatSDef(String name, String defName, AggregateFunction.Type aggregateFunction)
    : base(name)
 {
    DefName = defName;
    AggregateFunction = aggregateFunction;
 }