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);
        }
Example #2
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (obj == null || this.GetType() != obj.GetType())
            {
                return(false);
            }

            MonthPeriod other = obj as MonthPeriod;

            return(this.isEqualToPeriod(other));
        }
 private static bool SelectForPeriod(SpanOfYears span, MonthPeriod period)
 {
     return(period.Year() >= span.YearFrom && period.Year() <= span.YearUpto);
 }
 public static SpanOfMonths CreateFromYear(UInt16 year)
 {
     return(new SpanOfMonths(MonthPeriod.BeginYear(year), MonthPeriod.EndYear(year)));
 }
 public SpanOfMonths(MonthPeriod from, MonthPeriod upto)
 {
     this.PeriodFrom = (MonthPeriod)from.Clone();
     this.PeriodUpto = (MonthPeriod)upto.Clone();
 }
 public SpanOfMonths()
 {
     this.PeriodFrom = MonthPeriod.Empty();
     this.PeriodUpto = MonthPeriod.Empty();
 }
 public static SpanOfMonths CreateFromMonth(MonthPeriod period)
 {
     return(new SpanOfMonths(period, period));
 }
Example #8
0
        public virtual object Clone()
        {
            MonthPeriod otherPeriod = (MonthPeriod)this.MemberwiseClone();

            return(otherPeriod);
        }
Example #9
0
 public bool isEqualToPeriod(MonthPeriod other)
 {
     return(this.Code == other.Code);
 }
Example #10
0
        public int CompareTo(object obj)
        {
            MonthPeriod other = obj as MonthPeriod;

            return(this.Code.CompareTo(other.Code));
        }