private void RegenerateIntegralResult()
 {
     if (((IValueConsumer)this).GetProvider() is ValueBase)
     {
         TimeSpan          timeSpan  = interval.ToTimeSpan();
         ValueBase         valueBase = (ValueBase)((IValueConsumer)this).GetProvider();
         HistoryCollection history   = valueBase.History;
         integralResult = history.AccumulatedValue / (double)timeSpan.Ticks;
         int num = history.Locate(valueBase.Date);
         for (int i = 1; i < num; i++)
         {
             integralResult    += history[i].Value * (double)(history[i].Timestamp.Ticks - history[i - 1].Timestamp.Ticks) / (double)timeSpan.Ticks;
             oldValue.Timestamp = history[i].Timestamp;
             oldValue.Value     = history[i].Value;
         }
     }
 }
示例#2
0
        internal override object CloneInternals(object copy)
        {
            ValueBase valueBase = (ValueBase)base.CloneInternals(copy);

            valueBase.historyDept        = (GaugeDuration)historyDept.Clone();
            valueBase.queryDept          = (GaugeDuration)queryDept.Clone();
            valueBase.history            = (HistoryCollection)history.Clone();
            valueBase.ValueChanged       = null;
            valueBase.ValueLimitOverflow = null;
            valueBase.consumers          = new ArrayList();
            foreach (IValueConsumer consumer in consumers)
            {
                if (!(consumer is ValueBase))
                {
                    ((IValueProvider)valueBase).AttachConsumer(consumer);
                }
            }
            return(valueBase);
        }
 public HistoryCollection(ValueBase parent)
 {
     this.parent = parent;
 }