예제 #1
0
        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);
        }
예제 #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));
        }
예제 #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));
        }
예제 #4
0
 public bool isEqualToInterval(SpanOfYears other)
 {
     return(this.YearFrom == other.YearFrom && this.YearUpto == other.YearUpto);
 }
예제 #5
0
 private static bool SelectForPeriod(SpanOfYears span, MonthPeriod period)
 {
     return(period.Year() >= span.YearFrom && period.Year() <= span.YearUpto);
 }