public DateTimeSegment(string segment) { switch (segment) { case "TIME_YEAR": _portion = DateTimePortion.Year; break; case "TIME_MON": _portion = DateTimePortion.Month; break; case "TIME_DAY": _portion = DateTimePortion.Day; break; case "TIME_HOUR": _portion = DateTimePortion.Hour; break; case "TIME_MIN": _portion = DateTimePortion.Minute; break; case "TIME_SEC": _portion = DateTimePortion.Second; break; case "TIME_WDAY": _portion = DateTimePortion.DayOfWeek; break; case "TIME": _portion = DateTimePortion.Time; break; default: throw new FormatException($"Unsupported segment: '{segment}'"); } }
/// <summary> /// Create a strategy that clusters around the given parts /// </summary> /// <param name="portions"></param> /// <param name="format"></param> public DateTimeClusteringStrategy(DateTimePortion portions, string format) { this.Portions = portions; this.Format = format; }