Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public DatatSDef(String name, String defName, AggregateFunction.Type aggregateFunction)
     : base(name)
 {
     DefName           = defName;
     AggregateFunction = aggregateFunction;
 }
Ejemplo n.º 4
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));
 }
Ejemplo n.º 5
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));
 }
Ejemplo n.º 6
0
 public SDef(String name, String defName, AggregateFunction.Type function)
     : base(name)
 {
     this.defName           = defName;
     this.aggregateFunction = function;
 }
Ejemplo n.º 7
0
 public DatatSDef(String name, String defName, AggregateFunction.Type aggregateFunction)
    : base(name)
 {
    DefName = defName;
    AggregateFunction = aggregateFunction;
 }