[Calendar]Remove invalid exception
[platform/core/csapi/tizenfx.git] / src / Tizen.Pims.Calendar / Tizen.Pims.Calendar / CalendarStructs.cs
index 002ecba..0ddbac9 100644 (file)
@@ -21,6 +21,7 @@ namespace Tizen.Pims.Calendar
     /// <summary>
     /// A class for time to set, get or calculate.
     /// </summary>
+    /// <since_tizen> 4 </since_tizen>
     public class CalendarTime:IComparable<CalendarTime>
     {
         internal int _type;
@@ -29,21 +30,25 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Enumeration for the time type.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public enum Type
         {
             /// <summary>
             /// UTC time
             /// </summary>
+            /// <since_tizen> 4 </since_tizen>
             Utc,
             /// <summary>
             /// Local time
             /// </summary>
+            /// <since_tizen> 4 </since_tizen>
             Local
         }
 
         /// <summary>
         /// Create UTC CalendarTime
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="utcTime">UTC epoch time. 0 is 1971/01/01</param>
         public CalendarTime(long utcTime)
         {
@@ -55,14 +60,13 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Create Local CalendarTime
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="year">year</param>
         /// <param name="month">month</param>
         /// <param name="day">day</param>
         /// <param name="hour">hour</param>
         /// <param name="minute">minute</param>
         /// <param name="second">second</param>
-        /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
-        /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
         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
         /// <summary>
         /// Get UtcTime
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <value>The Utc time</value>
         public DateTime UtcTime
         {
@@ -81,6 +86,7 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Get localTime
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <value>The Localtime</value>
         public DateTime LocalTime
         {
@@ -90,12 +96,11 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Compare CalendarTime
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="other">The CalendarTime to be compared</param>
         /// <returns>
         /// A 32-bit signed integer that indicates the relative order of the objects being compared.
         /// </returns>
-        /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
-        /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
         public int CompareTo(CalendarTime other)
         {
             if (_type != other._type)
@@ -113,19 +118,18 @@ namespace Tizen.Pims.Calendar
         /// <summary>
         /// Equals CalendarTime
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="obj">The CalendarTime to be compared</param>
         /// <returns>
         /// A 32-bit signed integer that indicates the relative order of the objects being compared.
         /// </returns>
-        /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
-        /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
         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);
         }
+
+        /// <summary>
+        /// GetHashCode CalendarTime
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        /// <returns>
+        /// A hash code for the current object.
+        /// </returns>
+        public override int GetHashCode()
+        {
+            if (_type == (int)Type.Utc)
+                return this.UtcTime.GetHashCode();
+            else
+                return this.LocalTime.GetHashCode();
+        }
     }
 }