public ClosedIntervalView(string title, ClosedInterval closedInterval) { Debug.Assert(!string.IsNullOrWhiteSpace(title)); Debug.Assert(closedInterval != null); this.title = title; this.closedInterval = closedInterval; }
public virtual int Read(string title, int min, int max) { Debug.Assert(!string.ReferenceEquals(title, null)); ClosedInterval limits = new ClosedInterval(min, max); ClosedIntervalView limitsView = new ClosedIntervalView("El valor debe estar entre ", limits); int value; bool ok; do { value = IO.Instance().ReadInt(title + " " + limitsView + ": "); ok = limits.Includes(value); if (!ok) { limitsView.Writeln(); } } while (!ok); return(value); }