nus-yam/ex-repair huggingface dataset:
Program: 2514
Project: 2514
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_MARGIN_RELATIVE)   return endMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
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 ((mMarginFlags & NEED_RESOLUTION_MASK) == NEED_RESOLUTION_MASK) {
    doResolveMargins();
  }
switch (mMarginFlags & LAYOUT_DIRECTION_MASK) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}
Program: 2515
Project: 2515
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mLeftMarginUndefined=true;
  mRightMarginUndefined=true;
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mMarginFlags|=LEFT_MARGIN_UNDEFINED_MASK;
  mMarginFlags|=RIGHT_MARGIN_UNDEFINED_MASK;
  mMarginFlags&=~NEED_RESOLUTION_MASK;
  mMarginFlags&=~RTL_COMPATIBILITY_MODE_MASK;
}
Program: 2516
Project: 2516
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 mLayoutDirection;
}

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 (mMarginFlags & LAYOUT_DIRECTION_MASK);
}
Program: 2517
Project: 2517
Buggy source:
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;
}

Fixed version (ground truth):
private void doResolveMargins(){
  if ((mMarginFlags & RTL_COMPATIBILITY_MODE_MASK) == RTL_COMPATIBILITY_MODE_MASK) {
    if ((mMarginFlags & LEFT_MARGIN_UNDEFINED_MASK) == LEFT_MARGIN_UNDEFINED_MASK && startMargin > DEFAULT_MARGIN_RELATIVE) {
      leftMargin=startMargin;
    }
    if ((mMarginFlags & RIGHT_MARGIN_UNDEFINED_MASK) == RIGHT_MARGIN_UNDEFINED_MASK && endMargin > DEFAULT_MARGIN_RELATIVE) {
      rightMargin=endMargin;
    }
  }
 else {
switch (mMarginFlags & LAYOUT_DIRECTION_MASK) {
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;
}
}
mMarginFlags&=~NEED_RESOLUTION_MASK;
}
Program: 2518
Project: 2518
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)   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() || (mMarginFlags & NEED_RESOLUTION_MASK) != NEED_RESOLUTION_MASK)   return;
  doResolveMargins();
}
Program: 2519
Project: 2519
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;
  mNeedResolution=true;
}

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;
  mMarginFlags|=NEED_RESOLUTION_MASK;
}
Program: 2520
Project: 2520
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;
  mNeedResolution=true;
}

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;
  mMarginFlags|=NEED_RESOLUTION_MASK;
}
Program: 2521
Project: 2521
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;
  mNeedResolution=true;
}

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;
  mMarginFlags|=NEED_RESOLUTION_MASK;
}
Program: 2523
Project: 2523
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;
  if (layoutDirection != this.mLayoutDirection) {
    this.mLayoutDirection=layoutDirection;
    this.mNeedResolution=isMarginRelative();
  }
}

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 != (mMarginFlags & LAYOUT_DIRECTION_MASK)) {
    mMarginFlags&=~LAYOUT_DIRECTION_MASK;
    mMarginFlags|=(layoutDirection & LAYOUT_DIRECTION_MASK);
    if (isMarginRelative()) {
      mMarginFlags|=NEED_RESOLUTION_MASK;
    }
 else {
      mMarginFlags&=~NEED_RESOLUTION_MASK;
    }
  }
}
Program: 2524
Project: 2524
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_MARGIN_RELATIVE)   return startMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
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 ((mMarginFlags & NEED_RESOLUTION_MASK) == NEED_RESOLUTION_MASK) {
    doResolveMargins();
  }
switch (mMarginFlags & LAYOUT_DIRECTION_MASK) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}
Program: 2525
Project: 2525
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;
  mLeftMarginUndefined=false;
  mRightMarginUndefined=false;
  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;
  mMarginFlags&=~LEFT_MARGIN_UNDEFINED_MASK;
  mMarginFlags&=~RIGHT_MARGIN_UNDEFINED_MASK;
  if (isMarginRelative()) {
    mMarginFlags|=NEED_RESOLUTION_MASK;
  }
 else {
    mMarginFlags&=~NEED_RESOLUTION_MASK;
  }
}
Program: 2526
Project: 2526
Buggy source:
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
}

Fixed version (ground truth):
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return ((mMarginFlags & LAYOUT_DIRECTION_MASK) == View.LAYOUT_DIRECTION_RTL);
}
Program: 2527
Project: 2527
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_MARGIN_RELATIVE)   return endMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
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 ((mMarginFlags & NEED_RESOLUTION_MASK) == NEED_RESOLUTION_MASK) {
    doResolveMargins();
  }
switch (mMarginFlags & LAYOUT_DIRECTION_MASK) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}
Program: 2528
Project: 2528
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mLeftMarginUndefined=true;
  mRightMarginUndefined=true;
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mMarginFlags|=LEFT_MARGIN_UNDEFINED_MASK;
  mMarginFlags|=RIGHT_MARGIN_UNDEFINED_MASK;
  mMarginFlags&=~NEED_RESOLUTION_MASK;
  mMarginFlags&=~RTL_COMPATIBILITY_MODE_MASK;
}
Program: 2529
Project: 2529
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 mLayoutDirection;
}

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 (mMarginFlags & LAYOUT_DIRECTION_MASK);
}
Program: 2530
Project: 2530
Buggy source:
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;
}

Fixed version (ground truth):
private void doResolveMargins(){
  if ((mMarginFlags & RTL_COMPATIBILITY_MODE_MASK) == RTL_COMPATIBILITY_MODE_MASK) {
    if ((mMarginFlags & LEFT_MARGIN_UNDEFINED_MASK) == LEFT_MARGIN_UNDEFINED_MASK && startMargin > DEFAULT_MARGIN_RELATIVE) {
      leftMargin=startMargin;
    }
    if ((mMarginFlags & RIGHT_MARGIN_UNDEFINED_MASK) == RIGHT_MARGIN_UNDEFINED_MASK && endMargin > DEFAULT_MARGIN_RELATIVE) {
      rightMargin=endMargin;
    }
  }
 else {
switch (mMarginFlags & LAYOUT_DIRECTION_MASK) {
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;
}
}
mMarginFlags&=~NEED_RESOLUTION_MASK;
}
Program: 2531
Project: 2531
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)   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() || (mMarginFlags & NEED_RESOLUTION_MASK) != NEED_RESOLUTION_MASK)   return;
  doResolveMargins();
}
Program: 2532
Project: 2532
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;
  mNeedResolution=true;
}

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;
  mMarginFlags|=NEED_RESOLUTION_MASK;
}
Program: 2533
Project: 2533
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;
  mNeedResolution=true;
}

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;
  mMarginFlags|=NEED_RESOLUTION_MASK;
}
Program: 2534
Project: 2534
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;
  mNeedResolution=true;
}

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;
  mMarginFlags|=NEED_RESOLUTION_MASK;
}
Program: 2535
Project: 2535
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: 2536
Project: 2536
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: 2537
Project: 2537
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: 2538
Project: 2538
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: 2539
Project: 2539
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: 2540
Project: 2540
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: 2541
Project: 2541
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: 2542
Project: 2542
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: 2543
Project: 2543
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: 2544
Project: 2544
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: 2545
Project: 2545
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: 2546
Project: 2546
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: 2547
Project: 2547
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: 2548
Project: 2548
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: 2549
Project: 2549
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: 2550
Project: 2550
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: 2551
Project: 2551
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: 2552
Project: 2552
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: 2553
Project: 2553
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: 2554
Project: 2554
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: 2555
Project: 2555
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: 2556
Project: 2556
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();
}