using System;
using System.Collections.Generic;
using System.Text;

namespace Siger.Middlelayer.Repository.Data
{
    public class ToolLifeReportData
    {
        public List<ToolLifeReportNode> node;
        public ToolLifeReportData()
        {
            node = new List<ToolLifeReportNode>();
        }
        public void Add(string key, double value)
        {
            foreach (var item in node)
            {
                if (key == item.key)
                {
                    item.value.Add(value);
                    return;
                }
            }
            var temp = new ToolLifeReportNode();
            temp.key = key;
            temp.value.Add(value);
            node.Add(temp);
        }
        /// <summary>
        /// 如果存在key,添加value,否则添加value2
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="value2"></param>
        public void Add(string key, double value, double value2)
        {
            foreach (var item in node)
            {
                if (key == item.key)
                {
                    item.value.Add(value2);
                    return;
                }
            }
            var temp = new ToolLifeReportNode();
            temp.key = key;
            temp.value.Add(value);
            node.Add(temp);
        }
    }
    public class ToolLifeReportNode
    {
        public ToolLifeReportNode()
        {
            value = new List<double>();
        }
        public string key;
        public List<double> value;

    }
}
