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=002ecba4a51e112d9e36143d8d3fa920d59e7230;hpb=b80bd98a0c96ea83f920515201f16767fef68294;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 002ecba..0ddbac9 100644
--- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs
+++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs
@@ -21,6 +21,7 @@ namespace Tizen.Pims.Calendar
///
/// A class for time to set, get or calculate.
///
+ /// 4
public class CalendarTime:IComparable
{
internal int _type;
@@ -29,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)
{
@@ -55,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;
@@ -72,6 +76,7 @@ namespace Tizen.Pims.Calendar
///
/// Get UtcTime
///
+ /// 4
/// The Utc time
public DateTime UtcTime
{
@@ -81,6 +86,7 @@ namespace Tizen.Pims.Calendar
///
/// Get localTime
///
+ /// 4
/// The Localtime
public DateTime LocalTime
{
@@ -90,12 +96,11 @@ namespace Tizen.Pims.Calendar
///
/// Compare CalendarTime
///
+ /// 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 other)
{
if (_type != other._type)
@@ -113,19 +118,18 @@ namespace Tizen.Pims.Calendar
///
/// Equals CalendarTime
///
+ /// 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 override bool Equals(object obj)
{
var other = obj as CalendarTime;
if (_type != other._type)
{
Log.Error(Globals.LogTag, "Not to compare with different type");
- throw CalendarErrorFactory.GetException((int)CalendarError.InvalidParameter);
+ return false;
}
if (_type == (int)Type.Utc)
@@ -133,6 +137,21 @@ namespace Tizen.Pims.Calendar
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();
+ }
}
}