nus-yam/ex-repair huggingface dataset:
Program: 2557
Project: 2557
Buggy source:
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mNeedResolution=isMarginRelative();
}

Fixed version (ground truth):
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mLeftMarginUndefined=false;
  mRightMarginUndefined=false;
  mNeedResolution=isMarginRelative();
}
Program: 2558
Project: 2558
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mLeftMarginUndefined=true;
  mRightMarginUndefined=true;
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}
Program: 2559
Project: 2559
Buggy source:
private void doResolveMargins(){
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    leftMargin=(endMargin > DEFAULT_MARGIN_RELATIVE) ? endMargin : DEFAULT_MARGIN_RESOLVED;
  rightMargin=(startMargin > DEFAULT_MARGIN_RELATIVE) ? startMargin : DEFAULT_MARGIN_RESOLVED;
break;
case View.LAYOUT_DIRECTION_LTR:
default :
leftMargin=(startMargin > DEFAULT_MARGIN_RELATIVE) ? startMargin : DEFAULT_MARGIN_RESOLVED;
rightMargin=(endMargin > DEFAULT_MARGIN_RELATIVE) ? endMargin : DEFAULT_MARGIN_RESOLVED;
break;
}
mNeedResolution=false;
}

Fixed version (ground truth):
private void doResolveMargins(){
  if (mIsRtlCompatibilityMode) {
    if (mLeftMarginUndefined && startMargin > DEFAULT_MARGIN_RELATIVE) {
      leftMargin=startMargin;
    }
    if (mRightMarginUndefined && endMargin > DEFAULT_MARGIN_RELATIVE) {
      rightMargin=endMargin;
    }
  }
 else {
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
      leftMargin=(endMargin > DEFAULT_MARGIN_RELATIVE) ? endMargin : DEFAULT_MARGIN_RESOLVED;
    rightMargin=(startMargin > DEFAULT_MARGIN_RELATIVE) ? startMargin : DEFAULT_MARGIN_RESOLVED;
  break;
case View.LAYOUT_DIRECTION_LTR:
default :
leftMargin=(startMargin > DEFAULT_MARGIN_RELATIVE) ? startMargin : DEFAULT_MARGIN_RESOLVED;
rightMargin=(endMargin > DEFAULT_MARGIN_RELATIVE) ? endMargin : DEFAULT_MARGIN_RESOLVED;
break;
}
}
mNeedResolution=false;
}
Program: 2560
Project: 2560
Buggy source:
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode)   return;
  doResolveMargins();
}

Fixed version (ground truth):
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative() || !mNeedResolution)   return;
  doResolveMargins();
}
Program: 2561
Project: 2561
Buggy source:
private void reopenMenu(boolean toggleMenuMode){
  if (mActionBar != null && mActionBar.isOverflowReserved()) {
    final Callback cb=getCallback();
    if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
      if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        if (st.menu != null && !st.refreshMenuContent && cb.onPreparePanel(FEATURE_OPTIONS_PANEL,st.createdPanelView,st.menu)) {
          cb.onMenuOpened(FEATURE_ACTION_BAR,st.menu);
          mActionBar.showOverflowMenu();
        }
      }
    }
 else {
      mActionBar.hideOverflowMenu();
      if (cb != null && !isDestroyed()) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        cb.onPanelClosed(FEATURE_ACTION_BAR,st.menu);
      }
    }
    return;
  }
  PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
  boolean newExpandedMode=toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
  st.refreshDecorView=true;
  closePanel(st,false);
  st.isInExpandedMode=newExpandedMode;
  openPanel(st,null);
}

Fixed version (ground truth):
private void reopenMenu(boolean toggleMenuMode){
  if (mActionBar != null && mActionBar.isOverflowReserved()) {
    final Callback cb=getCallback();
    if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
      if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
        if (mInvalidatePanelMenuPosted && (mInvalidatePanelMenuFeatures & (1 << FEATURE_OPTIONS_PANEL)) != 0) {
          mDecor.removeCallbacks(mInvalidatePanelMenuRunnable);
          mInvalidatePanelMenuRunnable.run();
        }
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        if (st.menu != null && !st.refreshMenuContent && cb.onPreparePanel(FEATURE_OPTIONS_PANEL,st.createdPanelView,st.menu)) {
          cb.onMenuOpened(FEATURE_ACTION_BAR,st.menu);
          mActionBar.showOverflowMenu();
        }
      }
    }
 else {
      mActionBar.hideOverflowMenu();
      if (cb != null && !isDestroyed()) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        cb.onPanelClosed(FEATURE_ACTION_BAR,st.menu);
      }
    }
    return;
  }
  PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
  boolean newExpandedMode=toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
  st.refreshDecorView=true;
  closePanel(st,false);
  st.isInExpandedMode=newExpandedMode;
  openPanel(st,null);
}
Program: 2562
Project: 2562
Buggy source:
private void reopenMenu(boolean toggleMenuMode){
  if (mActionBar != null && mActionBar.isOverflowReserved()) {
    final Callback cb=getCallback();
    if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
      if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        if (st.menu != null && !st.refreshMenuContent && cb.onPreparePanel(FEATURE_OPTIONS_PANEL,st.createdPanelView,st.menu)) {
          cb.onMenuOpened(FEATURE_ACTION_BAR,st.menu);
          mActionBar.showOverflowMenu();
        }
      }
    }
 else {
      mActionBar.hideOverflowMenu();
      if (cb != null && !isDestroyed()) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        cb.onPanelClosed(FEATURE_ACTION_BAR,st.menu);
      }
    }
    return;
  }
  PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
  boolean newExpandedMode=toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
  st.refreshDecorView=true;
  closePanel(st,false);
  st.isInExpandedMode=newExpandedMode;
  openPanel(st,null);
}

Fixed version (ground truth):
private void reopenMenu(boolean toggleMenuMode){
  if (mActionBar != null && mActionBar.isOverflowReserved()) {
    final Callback cb=getCallback();
    if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
      if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
        if (mInvalidatePanelMenuPosted && (mInvalidatePanelMenuFeatures & (1 << FEATURE_OPTIONS_PANEL)) != 0) {
          mDecor.removeCallbacks(mInvalidatePanelMenuRunnable);
          mInvalidatePanelMenuRunnable.run();
        }
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        if (st.menu != null && !st.refreshMenuContent && cb.onPreparePanel(FEATURE_OPTIONS_PANEL,st.createdPanelView,st.menu)) {
          cb.onMenuOpened(FEATURE_ACTION_BAR,st.menu);
          mActionBar.showOverflowMenu();
        }
      }
    }
 else {
      mActionBar.hideOverflowMenu();
      if (cb != null && !isDestroyed()) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        cb.onPanelClosed(FEATURE_ACTION_BAR,st.menu);
      }
    }
    return;
  }
  PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
  boolean newExpandedMode=toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
  st.refreshDecorView=true;
  closePanel(st,false);
  st.isInExpandedMode=newExpandedMode;
  openPanel(st,null);
}
Program: 2563
Project: 2563
Buggy source:
private void reopenMenu(boolean toggleMenuMode){
  if (mActionBar != null && mActionBar.isOverflowReserved()) {
    final Callback cb=getCallback();
    if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
      if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        if (st.menu != null && !st.refreshMenuContent && cb.onPreparePanel(FEATURE_OPTIONS_PANEL,st.createdPanelView,st.menu)) {
          cb.onMenuOpened(FEATURE_ACTION_BAR,st.menu);
          mActionBar.showOverflowMenu();
        }
      }
    }
 else {
      mActionBar.hideOverflowMenu();
      if (cb != null && !isDestroyed()) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        cb.onPanelClosed(FEATURE_ACTION_BAR,st.menu);
      }
    }
    return;
  }
  PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
  boolean newExpandedMode=toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
  st.refreshDecorView=true;
  closePanel(st,false);
  st.isInExpandedMode=newExpandedMode;
  openPanel(st,null);
}

Fixed version (ground truth):
private void reopenMenu(boolean toggleMenuMode){
  if (mActionBar != null && mActionBar.isOverflowReserved()) {
    final Callback cb=getCallback();
    if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
      if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
        if (mInvalidatePanelMenuPosted && (mInvalidatePanelMenuFeatures & (1 << FEATURE_OPTIONS_PANEL)) != 0) {
          mDecor.removeCallbacks(mInvalidatePanelMenuRunnable);
          mInvalidatePanelMenuRunnable.run();
        }
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        if (st.menu != null && !st.refreshMenuContent && cb.onPreparePanel(FEATURE_OPTIONS_PANEL,st.createdPanelView,st.menu)) {
          cb.onMenuOpened(FEATURE_ACTION_BAR,st.menu);
          mActionBar.showOverflowMenu();
        }
      }
    }
 else {
      mActionBar.hideOverflowMenu();
      if (cb != null && !isDestroyed()) {
        final PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
        cb.onPanelClosed(FEATURE_ACTION_BAR,st.menu);
      }
    }
    return;
  }
  PanelFeatureState st=getPanelState(FEATURE_OPTIONS_PANEL,true);
  boolean newExpandedMode=toggleMenuMode ? !st.isInExpandedMode : st.isInExpandedMode;
  st.refreshDecorView=true;
  closePanel(st,false);
  st.isInExpandedMode=newExpandedMode;
  openPanel(st,null);
}
Program: 2564
Project: 2564
Buggy source:
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  this.layoutDirection=layoutDirection;
}

Fixed version (ground truth):
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  if (layoutDirection != this.mLayoutDirection) {
    this.mLayoutDirection=layoutDirection;
    this.mNeedResolution=isMarginRelative();
  }
}
Program: 2565
Project: 2565
Buggy source:
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_RELATIVE)   return startMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_MARGIN_RELATIVE)   return startMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}
Program: 2566
Project: 2566
Buggy source:
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  initialLeftMargin=left;
  initialRightMargin=right;
}

Fixed version (ground truth):
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mNeedResolution=isMarginRelative();
}
Program: 2567
Project: 2567
Buggy source:
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (layoutDirection == View.LAYOUT_DIRECTION_RTL);
}

Fixed version (ground truth):
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
}
Program: 2568
Project: 2568
Buggy source:
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_RELATIVE)   return endMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_MARGIN_RELATIVE)   return endMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}
Program: 2569
Project: 2569
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}
Program: 2570
Project: 2570
Buggy source:
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return layoutDirection;
}

Fixed version (ground truth):
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return mLayoutDirection;
}
Program: 2571
Project: 2571
Buggy source:
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative())   return;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    leftMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialLeftMargin;
  rightMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialRightMargin;
break;
case View.LAYOUT_DIRECTION_LTR:
default :
leftMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialLeftMargin;
rightMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialRightMargin;
break;
}
}

Fixed version (ground truth):
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode)   return;
  doResolveMargins();
}
Program: 2572
Project: 2572
Buggy source:
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_RELATIVE) || (endMargin != DEFAULT_RELATIVE);
}

Fixed version (ground truth):
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_MARGIN_RELATIVE || endMargin != DEFAULT_MARGIN_RELATIVE);
}
Program: 2573
Project: 2573
Buggy source:
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
}

Fixed version (ground truth):
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
  mNeedResolution=true;
}
Program: 2574
Project: 2574
Buggy source:
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  initialLeftMargin=0;
  initialRightMargin=0;
}

Fixed version (ground truth):
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  mNeedResolution=true;
}
Program: 2575
Project: 2575
Buggy source:
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
}

Fixed version (ground truth):
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
  mNeedResolution=true;
}
Program: 2576
Project: 2576
Buggy source:
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}
Program: 2577
Project: 2577
Buggy source:
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  this.layoutDirection=layoutDirection;
}

Fixed version (ground truth):
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  if (layoutDirection != this.mLayoutDirection) {
    this.mLayoutDirection=layoutDirection;
    this.mNeedResolution=isMarginRelative();
  }
}
Program: 2578
Project: 2578
Buggy source:
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_RELATIVE)   return startMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_MARGIN_RELATIVE)   return startMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}
Program: 2579
Project: 2579
Buggy source:
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  initialLeftMargin=left;
  initialRightMargin=right;
}

Fixed version (ground truth):
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mNeedResolution=isMarginRelative();
}
Program: 2580
Project: 2580
Buggy source:
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (layoutDirection == View.LAYOUT_DIRECTION_RTL);
}

Fixed version (ground truth):
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
}
Program: 2581
Project: 2581
Buggy source:
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_RELATIVE)   return endMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_MARGIN_RELATIVE)   return endMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}
Program: 2582
Project: 2582
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}
Program: 2583
Project: 2583
Buggy source:
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return layoutDirection;
}

Fixed version (ground truth):
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return mLayoutDirection;
}
Program: 2584
Project: 2584
Buggy source:
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative())   return;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    leftMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialLeftMargin;
  rightMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialRightMargin;
break;
case View.LAYOUT_DIRECTION_LTR:
default :
leftMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialLeftMargin;
rightMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialRightMargin;
break;
}
}

Fixed version (ground truth):
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode)   return;
  doResolveMargins();
}
Program: 2585
Project: 2585
Buggy source:
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_RELATIVE) || (endMargin != DEFAULT_RELATIVE);
}

Fixed version (ground truth):
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_MARGIN_RELATIVE || endMargin != DEFAULT_MARGIN_RELATIVE);
}
Program: 2586
Project: 2586
Buggy source:
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
}

Fixed version (ground truth):
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
  mNeedResolution=true;
}
Program: 2587
Project: 2587
Buggy source:
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  initialLeftMargin=0;
  initialRightMargin=0;
}

Fixed version (ground truth):
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  mNeedResolution=true;
}
Program: 2588
Project: 2588
Buggy source:
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
}

Fixed version (ground truth):
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
  mNeedResolution=true;
}
Program: 2589
Project: 2589
Buggy source:
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}
Program: 2590
Project: 2590
Buggy source:
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  this.layoutDirection=layoutDirection;
}

Fixed version (ground truth):
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  if (layoutDirection != this.mLayoutDirection) {
    this.mLayoutDirection=layoutDirection;
    this.mNeedResolution=isMarginRelative();
  }
}
Program: 2591
Project: 2591
Buggy source:
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_RELATIVE)   return startMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_MARGIN_RELATIVE)   return startMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}
Program: 2592
Project: 2592
Buggy source:
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  initialLeftMargin=left;
  initialRightMargin=right;
}

Fixed version (ground truth):
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mNeedResolution=isMarginRelative();
}
Program: 2593
Project: 2593
Buggy source:
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (layoutDirection == View.LAYOUT_DIRECTION_RTL);
}

Fixed version (ground truth):
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
}
Program: 2594
Project: 2594
Buggy source:
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_RELATIVE)   return endMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_MARGIN_RELATIVE)   return endMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}
Program: 2595
Project: 2595
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}
Program: 2596
Project: 2596
Buggy source:
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return layoutDirection;
}

Fixed version (ground truth):
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return mLayoutDirection;
}
Program: 2597
Project: 2597
Buggy source:
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative())   return;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    leftMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialLeftMargin;
  rightMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialRightMargin;
break;
case View.LAYOUT_DIRECTION_LTR:
default :
leftMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialLeftMargin;
rightMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialRightMargin;
break;
}
}

Fixed version (ground truth):
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode)   return;
  doResolveMargins();
}
Program: 2598
Project: 2598
Buggy source:
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_RELATIVE) || (endMargin != DEFAULT_RELATIVE);
}

Fixed version (ground truth):
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_MARGIN_RELATIVE || endMargin != DEFAULT_MARGIN_RELATIVE);
}
Program: 2599
Project: 2599
Buggy source:
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
}

Fixed version (ground truth):
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
  mNeedResolution=true;
}
Program: 2600
Project: 2600
Buggy source:
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  initialLeftMargin=0;
  initialRightMargin=0;
}

Fixed version (ground truth):
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  mNeedResolution=true;
}
Program: 2601
Project: 2601
Buggy source:
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
}

Fixed version (ground truth):
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
  mNeedResolution=true;
}
Program: 2602
Project: 2602
Buggy source:
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}