All files / src/repo/utils zcl_abapgit_repo_item_state.clas.abap

100% Statements 105/105
100% Branches 9/9
100% Functions 2/2
100% Lines 105/105

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 1061x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 6x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x  
CLASS zcl_abapgit_repo_item_state DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.
 
  PUBLIC SECTION.
 
    METHODS local
      RETURNING
        VALUE(rv_state) TYPE zif_abapgit_git_definitions=>ty_item_state.
    METHODS remote
      RETURNING
        VALUE(rv_state) TYPE zif_abapgit_git_definitions=>ty_item_state.
    METHODS is_reassigned
      RETURNING
        VALUE(rv_is_reassigned) TYPE abap_bool.
    METHODS is_unchanged
      RETURNING
        VALUE(rv_is_unchanged) TYPE abap_bool.
    METHODS sum_with_repo_item
      IMPORTING
        !is_repo_item TYPE zif_abapgit_definitions=>ty_repo_item.
    METHODS sum_with_status_item
      IMPORTING
        !is_status_item TYPE zif_abapgit_definitions=>ty_result.
  PROTECTED SECTION.
  PRIVATE SECTION.
    DATA mv_lstate TYPE zif_abapgit_git_definitions=>ty_item_state.
    DATA mv_rstate TYPE zif_abapgit_git_definitions=>ty_item_state.
    DATA mv_is_reassigned TYPE abap_bool.
 
    CLASS-METHODS reduce
      IMPORTING
        iv_prev       TYPE zif_abapgit_git_definitions=>ty_item_state
        iv_cur        TYPE zif_abapgit_git_definitions=>ty_item_state
      RETURNING
        VALUE(rv_new) TYPE zif_abapgit_git_definitions=>ty_item_state.
ENDCLASS.
 
 
 
CLASS zcl_abapgit_repo_item_state IMPLEMENTATION.
 
 
  METHOD is_reassigned.
    rv_is_reassigned = mv_is_reassigned.
  ENDMETHOD.
 
 
  METHOD is_unchanged.
    rv_is_unchanged = boolc( mv_is_reassigned = abap_false
      AND mv_lstate = zif_abapgit_definitions=>c_state-unchanged
      AND mv_rstate = zif_abapgit_definitions=>c_state-unchanged ).
  ENDMETHOD.
 
 
  METHOD local.
    rv_state = mv_lstate.
  ENDMETHOD.
 
 
  METHOD reduce.
 
    rv_new = iv_prev.
    IF rv_new = iv_cur OR iv_cur IS INITIAL.
      RETURN. " No change
    ELSEIF rv_new IS INITIAL.
      rv_new = iv_cur.
    ELSE.
      rv_new = zif_abapgit_definitions=>c_state-mixed.
    ENDIF.
 
  ENDMETHOD.
 
 
  METHOD remote.
    rv_state = mv_rstate.
  ENDMETHOD.
 
 
  METHOD sum_with_repo_item.
 
    mv_lstate = reduce(
      iv_prev = mv_lstate
      iv_cur  = is_repo_item-lstate ).
    mv_rstate = reduce(
      iv_prev = mv_rstate
      iv_cur  = is_repo_item-rstate ).
    mv_is_reassigned = boolc( mv_is_reassigned = abap_true OR is_repo_item-packmove = abap_true ).
 
  ENDMETHOD.
 
 
  METHOD sum_with_status_item.
 
    mv_lstate = reduce(
      iv_prev = mv_lstate
      iv_cur  = is_status_item-lstate ).
    mv_rstate = reduce(
      iv_prev = mv_rstate
      iv_cur  = is_status_item-rstate ).
    mv_is_reassigned = boolc( mv_is_reassigned = abap_true OR is_status_item-packmove = abap_true ).
 
  ENDMETHOD.
ENDCLASS.