| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

「ファンクションポイント 簡易マクロ」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
(ページの作成:「==ファンクションポイント 簡易マクロ== [ファンクションポイント][Excel VBA] Const KEY_VALUE_DELIM_CHAR = ":" Const TRANSACTIONAL_TYPE_EI…」)
(相違点なし)

2020年2月15日 (土) 07:29時点における版

ファンクションポイント 簡易マクロ

[ファンクションポイント][Excel VBA]


Const KEY_VALUE_DELIM_CHAR = ":"
Const TRANSACTIONAL_TYPE_EI = "EI"
Const TRANSACTIONAL_TYPE_EO = "EO"
Const TRANSACTIONAL_TYPE_EQ = "EQ"

Const TRANSACTIONAL_COMPLEXITY_LOW = "LOW"
Const TRANSACTIONAL_COMPLEXITY_AVG = "AVG"
Const TRANSACTIONAL_COMPLEXITY_HIGH = "HIGH"


'
'トランザクショナルファンクションの複雑度を判定
'
Public Function FP_CALC_COMPLEXITY(TransactionalFunctionType As Range, det As Range, ftr As Range) As String
    Dim ft      As String
    Dim intDet  As Integer
    Dim intFtr  As Integer
    
    ft = Split(TransactionalFunctionType(1, 1).Text, KEY_VALUE_DELIM_CHAR)(0)
    intDet = CInt(Val(det(1, 1).Text))
    intFtr = CInt(Val(ftr(1, 1).Text))
    
    Select Case ft
    Case TRANSACTIONAL_TYPE_EI
        ret = CalcComplexityEI(intDet, intFtr)
    Case TRANSACTIONAL_TYPE_EO
        ret = CalcComplexityEO_EQ(intDet, intFtr)
    Case TRANSACTIONAL_TYPE_EQ
        ret = CalcComplexityEO_EQ(intDet, intFtr)
    End Select
    
    FP_CALC_COMPLEXITY = ret
End Function
Public Function FP_CALC_FUNCTION_POINT(TransactionalFunctionType As Range, complexity As Range) As Integer
    Dim ret     As String
    Dim ft      As String
    Dim comp    As String
    
    ft = Split(TransactionalFunctionType(1, 1).Text, KEY_VALUE_DELIM_CHAR)(0)
    comp = UCase(Trim(complexity(1, 1).Text))
    
    Select Case ft
    Case TRANSACTIONAL_TYPE_EI
        Select Case comp
        Case TRANSACTIONAL_COMPLEXITY_LOW
            ret = "3"
        Case TRANSACTIONAL_COMPLEXITY_AVG
            ret = "4"
        Case TRANSACTIONAL_COMPLEXITY_HIGH
            ret = "6"
        End Select
    Case TRANSACTIONAL_TYPE_EO
        Select Case comp
        Case TRANSACTIONAL_COMPLEXITY_LOW
            ret = "4"
        Case TRANSACTIONAL_COMPLEXITY_AVG
            ret = "5"
        Case TRANSACTIONAL_COMPLEXITY_HIGH
            ret = "7"
        End Select
    Case TRANSACTIONAL_TYPE_EQ
        Select Case comp
        Case TRANSACTIONAL_COMPLEXITY_LOW
            ret = "3"
        Case TRANSACTIONAL_COMPLEXITY_AVG
            ret = "4"
        Case TRANSACTIONAL_COMPLEXITY_HIGH
            ret = "6"
        End Select
    End Select
    
    
    FP_CALC_FUNCTION_POINT = CInt(Val(ret))
End Function



'
' EIの複雑度を計算
'
Private Function CalcComplexityEI(det As Integer, ftr As Integer) As String
    Dim ret As String
    
    If ftr <= 1 Then
        If det <= 4 Then
            ret = TRANSACTIONAL_COMPLEXITY_LOW
        End If
        If 5 <= det And det <= 15 Then
            ret = TRANSACTIONAL_COMPLEXITY_LOW
        End If
        If 16 <= det Then
            ret = TRANSACTIONAL_COMPLEXITY_AVG
        End If
    End If

    If ftr = 2 Then
        If det <= 4 Then
            ret = TRANSACTIONAL_COMPLEXITY_LOW
        End If
        If 5 <= det And det <= 15 Then
            ret = TRANSACTIONAL_COMPLEXITY_AVG
        End If
        If 16 <= det Then
            ret = TRANSACTIONAL_COMPLEXITY_HIGH
        End If
    End If
    
    If 3 <= ftr Then
        If det <= 4 Then
            ret = TRANSACTIONAL_COMPLEXITY_AVG
        End If
        If 5 <= det And det <= 15 Then
            ret = TRANSACTIONAL_COMPLEXITY_HIGH
        End If
        If 16 <= det Then
            ret = TRANSACTIONAL_COMPLEXITY_HIGH
        End If
    End If
    
    CalcComplexityEI = ret
End Function
'
' EO、EQ の複雑度を計算
'
Private Function CalcComplexityEO_EQ(det As Integer, ftr As Integer) As String
    Dim ret As String
    
    If ftr <= 1 Then
        If det <= 5 Then
            ret = TRANSACTIONAL_COMPLEXITY_LOW
        End If
        If 6 <= det And det <= 19 Then
            ret = TRANSACTIONAL_COMPLEXITY_LOW
        End If
        If 20 <= det Then
            ret = TRANSACTIONAL_COMPLEXITY_AVG
        End If
    End If

    If 2 <= ftr And ftr <= 3 Then
        If det <= 5 Then
            ret = TRANSACTIONAL_COMPLEXITY_LOW
        End If
        If 6 <= det And det <= 19 Then
            ret = TRANSACTIONAL_COMPLEXITY_AVG
        End If
        If 20 <= det Then
            ret = TRANSACTIONAL_COMPLEXITY_HIGH
        End If
    End If
    
    If 4 <= ftr Then
        If det <= 5 Then
            ret = TRANSACTIONAL_COMPLEXITY_AVG
        End If
        If 6 <= det And det <= 19 Then
            ret = TRANSACTIONAL_COMPLEXITY_HIGH
        End If
        If 20 <= det Then
            ret = TRANSACTIONAL_COMPLEXITY_HIGH
        End If
    End If
    
    CalcComplexityEO_EQ = ret

End Function