using System;
namespace PhoenixLib.Scheduler
{
///
/// This class wraps a time interval.
/// You can use this class to process some recurring operations with a delay.
/// The delay can be represented by this class.
///
public class Interval
{
///
/// Minute's value.
///
public byte Minute { get; private set; }
///
/// Hour's value.
///
public byte Hour { get; private set; }
///
/// Specifies how many minute is required by the interval to be completed.
///
/// An integer withing [0; 59] range
///
public Interval EveryMinute(byte minute)
{
if (minute > 59)
{
throw new InvalidOperationException("Minute should be between 0~59.");
}
Minute = minute;
return this;
}
///
/// Specifies how many hours is required by the interval to be completed.
///
/// An integer withing [0; 23] range
///
public Interval EveryHour(byte hour)
{
if (hour > 23)
{
throw new InvalidOperationException("Hour should be between 0~23.");
}
Hour = hour;
return this;
}
}
}