Changeset 93


Ignore:
Timestamp:
Feb 12, 2007, 12:04:01 PM (18 years ago)
Author:
OverTaker
Message:

いくつかのメソッドを静的メンバに修正。その他、細かい修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/DateTime.ab

    r82 r93  
    8585    End Sub
    8686
    87     Function Operator == (ByRef value As DateTime) As BOOL
     87    Function Operator == (ByRef value As DateTime) As Boolean
    8888        Return Equals(value)
    8989    End Function
    9090
    91     Function Operator <> (ByRef value As DateTime) As BOOL
     91    Function Operator <> (ByRef value As DateTime) As Boolean
    9292        Return Not Equals(value)
    9393    End Function
    9494
    95     Function Operator > (ByRef value As DateTime) As BOOL
     95    Function Operator > (ByRef value As DateTime) As Boolean
    9696        If DateTime.Compare(This, value) > 0 Then
    97             Return _System_TRUE
    98         Else
    99             Return _System_FALSE
    100         End If
    101     End Function
    102 
    103     Function Operator < (ByRef value As DateTime) As BOOL
     97            Return True
     98        Else
     99            Return False
     100        End If
     101    End Function
     102
     103    Function Operator < (ByRef value As DateTime) As Boolean
    104104        If DateTime.Compare(This, value) < 0 Then
    105             Return _System_TRUE
    106         Else
    107             Return _System_FALSE
    108         End If
    109     End Function
    110 
    111     Function Operator >= (ByRef value As DateTime) As BOOL
     105            Return True
     106        Else
     107            Return False
     108        End If
     109    End Function
     110
     111    Function Operator >= (ByRef value As DateTime) As Boolean
    112112        If DateTime.Compare(This, value) => 0 Then
    113             Return _System_TRUE
    114         Else
    115             Return _System_FALSE
    116         End If
    117     End Function
    118 
    119     Function Operator <= (ByRef value As DateTime) As BOOL
     113            Return True
     114        Else
     115            Return False
     116        End If
     117    End Function
     118
     119    Function Operator <= (ByRef value As DateTime) As Boolean
    120120        If DateTime.Compare(This, value) <= 0 Then
    121             Return _System_TRUE
    122         Else
    123             Return _System_FALSE
     121            Return True
     122        Else
     123            Return False
    124124        End If
    125125    End Function
     
    222222    End Function
    223223
    224     Function Equals(ByRef value As DateTime) As BOOL
     224    Function Equals(ByRef value As DateTime) As Boolean
    225225        If value.m_Date = m_Date Then
    226             Return _System_TRUE
    227         Else
    228             Return _System_FALSE
    229         End If
    230     End Function
    231 
    232     Static Function Equals(ByRef t1 As DateTime, ByRef t2 As DateTime) As BOOL
     226            Return True
     227        Else
     228            Return False
     229        End If
     230    End Function
     231
     232    Static Function Equals(ByRef t1 As DateTime, ByRef t2 As DateTime) As Boolean
    233233        If t1.m_Date = t2.m_Date Then
    234             Return _System_TRUE
    235         Else
    236             Return _System_FALSE
     234            Return True
     235        Else
     236            Return False
    237237        End If
    238238    End Function
     
    287287    End Sub
    288288
    289     Function DaysInMonth(year As Long, month As Long) As Long
     289    Static Function DaysInMonth(year As Long, month As Long) As Long
    290290        If year < 1 Or year > 9999 Or month < 1 Or month > 12 Then
    291291            'ArgumentOutOfRangeException
    292292            debug
    293293        End If
    294         Select Case month
    295             Case 1
    296                 Return 31
    297             Case 2
    298                 If IsLeapYear(year) = TRUE Then
    299                     Return 29
    300                 Else
    301                     Return 28
    302                 End If
    303             Case 3
    304                 Return 31
    305             Case 4
    306                 Return 30
    307             Case 5
    308                 Return 31
    309             Case 6
    310                 Return 30
    311             Case 7
    312                 Return 31
    313             Case 8
    314                 Return 31
    315             Case 9
    316                 Return 30
    317             Case 10
    318                 Return 31
    319             Case 11
    320                 Return 30
    321             Case 12
    322                 Return 31
    323         End Select
    324     End Function
    325 
    326     Function IsLeapYear(year As Long) As BOOL
    327         If (year Mod 4) = 0 Then
    328             If (year Mod 100) = 0 Then
    329                 If (year Mod 400) = 0 Then
    330                     Return _System_TRUE
    331                 End If
    332                 Return _System_FALSE
    333             Else
    334                 Return _System_TRUE
    335             End If
    336         End If
    337         Return _System_FALSE
     294        If IsLeapYear(year) And month = 2 Then
     295            Return 29
     296        Else
     297            Dim daysInMonth[11] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] As Byte
     298            Return daysInMonth[month - 1]
     299        End If
     300    End Function
     301
     302    Static Function IsLeapYear(year As Long) As Boolean
     303        If (year Mod 400) = 0 Then Return True
     304        If (year Mod 100) = 0 Then Return False
     305        If (year Mod 4) = 0 Then Return True
    338306    End Function
    339307
Note: See TracChangeset for help on using the changeset viewer.