All pastes #470144 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-04 02:48 UTC
rendered paste body
using System;
using System.Collections;
using System.Text;

namespace InsulinSim
{
  [Serializable()]
    public class DataCollection
    {
    private String description;
    private double latest_time;
    
    public DataCollection(String _description) {
        this.description = _description;
        latest_time = 0;
    }

    public bool insertData(double time, double data){
        if (time > latest_time)
        {

            if (data < 0)
                data = 0;

            if (data > 240)
                data = 240;

            this.Add(createPoint(time, data));
            latest_time = time;
            return true;
        }

        return false;
    }


      private DataPoint createPoint(double time, double data)
      {
          return new DataPoint(time, data);
      }

      public String Description
      {
          get { return this.description; }
      }

        public DataPoint DataPoint
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
            }
        }
}
}