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)); }
public virtual bool RemoveSubEventInsertRule(SubEventInsertRule rule) { if (_subEventInsertRules.Remove(rule)) { _termSet.Clear(); _termSet.Add(this); SubEventInsertRules = _subEventInsertRules; return(true); } return(false); }
public bool Equals(SubEventInsertRule x, SubEventInsertRule y) { if (ReferenceEquals(x, y)) { return(true); } if (x == null || y == null) { return(false); } return(x.Equals(y)); }
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); } }
/// <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); }
public int GetHashCode(SubEventInsertRule obj) { return(obj.GetHashCode()); }