/// <summary> /// Determines whether an interval contains a point in time. The interval need not have /// high and low bounds specified. /// </summary> /// /// <param name="dateInterval">the interval to check</param> /// <param name="date">the date to apply to the given interval</param> /// <returns>whether the supplied interval contains the supplied date</returns> public static bool Contains(Interval <Ca.Infoway.Messagebuilder.PlatformDate> dateInterval, Ca.Infoway.Messagebuilder.PlatformDate date) { if (dateInterval == null) { return(false); } else if (date == null) { return(true); } else { Ca.Infoway.Messagebuilder.PlatformDate low = dateInterval.Low; Ca.Infoway.Messagebuilder.PlatformDate high = dateInterval.High; return((low != null || high != null) && (low == null || low.Time <= date.Time) && (high == null || high.Time >= date.Time)); } }
private static long GetLow(Interval <Ca.Infoway.Messagebuilder.PlatformDate> interval) { Ca.Infoway.Messagebuilder.PlatformDate low = interval.Low; if (low == null) { if (Representation.HIGH.Equals(interval.Representation)) { return(Int64.MinValue); } else if (Representation.SIMPLE.Equals(interval.Representation)) { return(interval.Value.Time); } else if (Representation.CENTRE.Equals(interval.Representation)) { return(interval.Centre.Time); } else { return(Int64.MaxValue); } } return(low.Time); }
private static long GetHigh(Interval <Ca.Infoway.Messagebuilder.PlatformDate> interval) { Ca.Infoway.Messagebuilder.PlatformDate high = interval.High; if (high == null) { if (Representation.LOW.Equals(interval.Representation)) { return(Int64.MaxValue); } else if (Representation.SIMPLE.Equals(interval.Representation)) { return(interval.Value.Time); } else if (Representation.CENTRE.Equals(interval.Representation)) { return(interval.Centre.Time); } else { return(Int64.MinValue); } } return(high.Time); }
/// <summary>Instantiates a new date.</summary> /// <remarks>Instantiates a new date.</remarks> /// <param name=" Date">the date</param> /// <param name="datePattern">the date pattern</param> public DateWithPattern(Ca.Infoway.Messagebuilder.PlatformDate objDate, string datePattern) : base(objDate.Time) { this.datePattern = datePattern; }