X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Pims.Calendar%2FTizen.Pims.Calendar%2FCalendarStructs.cs;h=0ddbac9acf072259c8e22fe3c3e7b88ecfb77332;hb=046083ce06b6dba8f2f93b9de11f096a67b8b47d;hp=3ac883ce83b5ba6a90884b20bea50a050d7265f4;hpb=20413d22431df16b773faaf9d913553bbcfaf49d;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs
index 3ac883c..0ddbac9 100644
--- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs
+++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs
@@ -15,14 +15,14 @@
*/
using System;
-using System.Runtime.InteropServices;
namespace Tizen.Pims.Calendar
{
///
- /// A class for time to set, get or calcurate.
+ /// A class for time to set, get or calculate.
///
- public class CalendarTime : IComparable
+ /// 4
+ public class CalendarTime:IComparable
{
internal int _type;
internal const int milliseconds = 10000000;
@@ -30,21 +30,25 @@ namespace Tizen.Pims.Calendar
///
/// Enumeration for the time type.
///
+ /// 4
public enum Type
{
///
/// UTC time
///
+ /// 4
Utc,
///
/// Local time
///
+ /// 4
Local
}
///
/// Create UTC CalendarTime
///
+ /// 4
/// UTC epoch time. 0 is 1971/01/01
public CalendarTime(long utcTime)
{
@@ -56,14 +60,13 @@ namespace Tizen.Pims.Calendar
///
/// Create Local CalendarTime
///
+ /// 4
/// year
/// month
/// day
/// hour
/// minute
/// second
- /// Thrown when one of the arguments provided to a method is not valid
- /// Thrown when failed due to out of memory
public CalendarTime(int year, int month, int day, int hour, int minute, int second)
{
_type = (int)Type.Local;
@@ -71,8 +74,10 @@ namespace Tizen.Pims.Calendar
}
///
- /// Get utcTime
+ /// Get UtcTime
///
+ /// 4
+ /// The Utc time
public DateTime UtcTime
{
get;
@@ -81,6 +86,8 @@ namespace Tizen.Pims.Calendar
///
/// Get localTime
///
+ /// 4
+ /// The Localtime
public DateTime LocalTime
{
get;
@@ -89,24 +96,61 @@ namespace Tizen.Pims.Calendar
///
/// Compare CalendarTime
///
- /// The CalendarTime to be compared
+ /// 4
+ /// The CalendarTime to be compared
///
/// A 32-bit signed integer that indicates the relative order of the objects being compared.
///
- /// Thrown when one of the arguments provided to a method is not valid
- /// Thrown when failed due to out of memory
- public int CompareTo(CalendarTime t)
+ public int CompareTo(CalendarTime other)
{
- if (_type != t._type)
+ if (_type != other._type)
{
Log.Error(Globals.LogTag, "Not to compare with different type");
throw CalendarErrorFactory.GetException((int)CalendarError.InvalidParameter);
}
if (_type == (int)Type.Utc)
- return UtcTime.CompareTo(t.UtcTime);
+ return UtcTime.CompareTo(other.UtcTime);
else
- return LocalTime.CompareTo(t.LocalTime);
+ return LocalTime.CompareTo(other.LocalTime);
+ }
+
+ ///
+ /// Equals CalendarTime
+ ///
+ /// 4
+ /// The CalendarTime to be compared
+ ///
+ /// A 32-bit signed integer that indicates the relative order of the objects being compared.
+ ///
+ public override bool Equals(object obj)
+ {
+ var other = obj as CalendarTime;
+ if (_type != other._type)
+ {
+ Log.Error(Globals.LogTag, "Not to compare with different type");
+ return false;
+ }
+
+ if (_type == (int)Type.Utc)
+ return UtcTime.Equals(other.UtcTime);
+ else
+ return LocalTime.Equals(other.LocalTime);
+ }
+
+ ///
+ /// GetHashCode CalendarTime
+ ///
+ /// 4
+ ///
+ /// A hash code for the current object.
+ ///
+ public override int GetHashCode()
+ {
+ if (_type == (int)Type.Utc)
+ return this.UtcTime.GetHashCode();
+ else
+ return this.LocalTime.GetHashCode();
}
}
}