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

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