예제 #1
0
 public bool Equals(SubEventInsertRule other)
 {
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(SubEvent.Equals(other.SubEvent) && (
                TimeRange.StartValue == other.TimeRange.StartValue ||
                TimeRange.EndValue == other.TimeRange.EndValue));
 }
예제 #2
0
 public virtual bool RemoveSubEventInsertRule(SubEventInsertRule rule)
 {
     if (_subEventInsertRules.Remove(rule))
     {
         _termSet.Clear();
         _termSet.Add(this);
         SubEventInsertRules = _subEventInsertRules;
         return(true);
     }
     return(false);
 }
예제 #3
0
 public bool Equals(SubEventInsertRule x, SubEventInsertRule y)
 {
     if (ReferenceEquals(x, y))
     {
         return(true);
     }
     if (x == null || y == null)
     {
         return(false);
     }
     return(x.Equals(y));
 }
예제 #4
0
        public virtual void ArrangeSubEvent(IAssignment newTerm, SubEventInsertRule rule, int randomOffset)
        {
            var startTime   = newTerm.Start.AddMinutes(rule.TimeRange.StartValue + (randomOffset * rule.OccurScale));
            var newSubEvent = Term.New(startTime, rule.SubEvent, rule.SubEventLength);

            if (newSubEvent.IsInTheRange(newTerm.Start, newTerm.End))
            {
                Create(newSubEvent, (t, success) =>
                {
                }, false);
            }
        }
예제 #5
0
        /// <summary>
        /// AddSubEventInsertRule with checking IsCoverd, IsInTheRange
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        public virtual bool AddSubEventInsertRule(SubEventInsertRule rule)
        {
            //GetEnumerator();

            rule.SetNewTime(Start.AddMinutes(rule.TimeRange.StartValue), default(DateTime));

            if (!rule.IsInTheRange(Start, End))
            {
                return(false);
            }

            if (_subEventInsertRules.Any(o => !ReferenceEquals(rule, o) && rule.IsCoverd(o)))
            {
                return(false);
            }

            _subEventInsertRules.Add(rule);
            _termSet.Clear();
            _termSet.Add(this);
            SubEventInsertRules = _subEventInsertRules;
            return(true);
        }
예제 #6
0
 public int GetHashCode(SubEventInsertRule obj)
 {
     return(obj.GetHashCode());
 }