private static IEnumerable <string> ResolveByDateRangeConstraints(IEnumerable <string> candidates, IEnumerable <TimexProperty> timexConstraints)
        {
            var dateRangeconstraints = timexConstraints
                                       .Where((timex) =>
            {
                return(timex.Types.Contains(Constants.TimexTypes.DateRange));
            })
                                       .Select((timex) =>
            {
                return(TimexHelpers.DateRangeFromTimex(timex));
            });

            var collapsedDateRanges = TimexConstraintsHelper.Collapse(dateRangeconstraints);

            if (!collapsedDateRanges.Any())
            {
                return(candidates);
            }

            var resolution = new List <string>();

            foreach (var timex in candidates)
            {
                var r = ResolveDate(new TimexProperty(timex), collapsedDateRanges);
                resolution.AddRange(r);
            }

            return(RemoveDuplicates(resolution));
        }
        private static IEnumerable <string> ResolveTimeRange(TimexProperty timex, IEnumerable <TimeRange> constraints)
        {
            var candidate = TimexHelpers.TimeRangeFromTimex(timex);

            var result = new List <string>();

            foreach (var constraint in constraints)
            {
                if (TimexConstraintsHelper.IsOverlapping(candidate, constraint))
                {
                    var start = Math.Max(candidate.Start.GetTime(), constraint.Start.GetTime());
                    var time  = new Time(start);

                    // TODO: consider a method on TimexProperty to do this clone/overwrite pattern
                    var resolved = timex.Clone();
                    resolved.PartOfDay = null;
                    resolved.Seconds   = null;
                    resolved.Minutes   = null;
                    resolved.Hours     = null;
                    resolved.Second    = time.Second;
                    resolved.Minute    = time.Minute;
                    resolved.Hour      = time.Hour;

                    result.Add(resolved.TimexValue);
                }
            }

            return(result);
        }