diff options
Diffstat (limited to 'lib/utility/Year.cs')
| -rw-r--r-- | lib/utility/Year.cs | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/lib/utility/Year.cs b/lib/utility/Year.cs index 6a1712e..c24c88b 100644 --- a/lib/utility/Year.cs +++ b/lib/utility/Year.cs @@ -1,53 +1,53 @@ -using System;
-
-namespace gorilla.utility
-{
- public class Year
- {
- readonly int the_underlying_year;
-
- public Year(int year) : this(new DateTime(year, 01, 01))
- {
- }
-
- public Year(DateTime date)
- {
- the_underlying_year = date.Year;
- }
-
- static public implicit operator Year(int year)
- {
- return new Year(year);
- }
-
- public bool Equals(Year obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- return obj.the_underlying_year == the_underlying_year;
- }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (Year)) return false;
- return Equals((Year) obj);
- }
-
- public override int GetHashCode()
- {
- return the_underlying_year;
- }
-
- public bool represents(DateTime time)
- {
- return time.Year.Equals(the_underlying_year);
- }
-
- public override string ToString()
- {
- return the_underlying_year.ToString();
- }
- }
-}
\ No newline at end of file +using System; + +namespace jive.utility +{ + public class Year + { + readonly int the_underlying_year; + + public Year(int year) : this(new DateTime(year, 01, 01)) + { + } + + public Year(DateTime date) + { + the_underlying_year = date.Year; + } + + static public implicit operator Year(int year) + { + return new Year(year); + } + + public bool Equals(Year obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.the_underlying_year == the_underlying_year; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != typeof (Year)) return false; + return Equals((Year) obj); + } + + public override int GetHashCode() + { + return the_underlying_year; + } + + public bool represents(DateTime time) + { + return time.Year.Equals(the_underlying_year); + } + + public override string ToString() + { + return the_underlying_year.ToString(); + } + } +} |
