public SpanOfYears YearsIntervalForPeriod(MonthPeriod period)
        {
            SpanOfYears[] validSpan = Milestones.Where((x) => SeqOfYears.SelectForPeriod(x, period)).ToArray();
            SpanOfYears   firstSpan = validSpan.FirstOrDefault();

            return(firstSpan == null?SpanOfYears.Empty() : firstSpan);
        }
Beispiel #2
0
        public int CompareTo(object obj)
        {
            SpanOfYears other = obj as SpanOfYears;

            if (this.YearFrom != other.YearFrom)
            {
                return(this.YearFrom.CompareTo(other.YearFrom));
            }
            return(this.YearUpto.CompareTo(other.YearUpto));
        }
Beispiel #3
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (obj == null || this.GetType() != obj.GetType())
            {
                return(false);
            }

            SpanOfYears other = obj as SpanOfYears;

            return(this.isEqualToInterval(other));
        }
Beispiel #4
0
 public bool isEqualToInterval(SpanOfYears other)
 {
     return(this.YearFrom == other.YearFrom && this.YearUpto == other.YearUpto);
 }
 private static bool SelectForPeriod(SpanOfYears span, MonthPeriod period)
 {
     return(period.Year() >= span.YearFrom && period.Year() <= span.YearUpto);
 }