-
Notifications
You must be signed in to change notification settings - Fork 0
/
IMonth.cs
59 lines (57 loc) · 1.92 KB
/
IMonth.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
namespace KCalendar
{
public class IMonth
{
public IMonth(string name, string shortName, int index, bool isLeapMonth, int normalLength, int leapLength)
{
IsLeapMonth = isLeapMonth;
NormalLength = normalLength;
LeapLength = leapLength;
Name = name;
ShortName = shortName;
Index = index;
}
public IMonth(string name, string shortName, int index, int normalLength)
{
IsLeapMonth = false;
NormalLength = normalLength;
LeapLength = normalLength;
Name = name;
ShortName = shortName;
Index = index;
}
public IMonth(string name, int index, bool isLeapMonth, int normalLength, int leapLength)
{
IsLeapMonth = isLeapMonth;
NormalLength = normalLength;
LeapLength = leapLength;
Name = name;
ShortName = name[0].ToString();
Index = index;
}
public IMonth(string name, int index, int normalLength)
{
IsLeapMonth = false;
NormalLength = normalLength;
LeapLength = normalLength;
Name = name;
ShortName = name[0].ToString();
Index = index;
}
public bool IsLeapMonth { get; private set; }
public int NormalLength { get; private set; }
public int LeapLength { get; private set; }
public string Name { get; private set; }
public string ShortName { get; private set; }
public int Index { get; private set; }
internal void SetLeap(bool isLeapYear)
{
if (LeapLength == NormalLength) return;
IsLeapMonth = isLeapYear;
}
public static implicit operator int(IMonth month)
{
return month.Index;
}
}
}