Exemple #1
0
        public static (bool success, HashSet<EquipmentState> results) DoList(HashSet<EquipmentState> standard, EquipmentState comparison)
        {
            if (standard == null)
            {
                return (false, null);
            }

            var temp = new HashSet<EquipmentState>(standard);

            if (comparison == null)
            {
                return (true, temp);
            }

            if (!temp.Add(comparison))
            {
                //既に同じ値が存在している
                return (true, temp);
            }

            var (success, _, results) = SelfHealing(temp);

            return (success, results);
        }
Exemple #2
0
        /// <summary>
        /// マージを実行する
        /// </summary>
        /// <param name="standard"></param>
        /// <param name="comparison"></param>
        /// <returns></returns>
        public static (bool success, EquipmentState newDay) Do(EquipmentState standard, EquipmentState comparison)
        {
            //完全に重ならない
            if (standard.validend_dt < comparison.validsta_dt || comparison.validend_dt < standard.validsta_dt)
            {
                return (false, null);
            }

            //何れかが重なるる
            var ns = standard.validsta_dt < comparison.validsta_dt ? standard.validsta_dt : comparison.validsta_dt;
            var ne = comparison.validend_dt < standard.validend_dt ? standard.validend_dt : comparison.validend_dt;
#if DEBUG
            Console.WriteLine((ns, ne));
#endif
            return (true, new EquipmentState() { validsta_dt = ns, validend_dt = ne });
        }