Program: 198986
Project: 198986
Buggy source:
/** 
 * Determine the positions for the views. This is the main part of the algorithm.
 * @param resultState The result state to update if a change to the properties of a child occurs
 * @param algorithmState The state in which the current pass of the algorithm is currently in
 */
private void updatePositionsForState(StackScrollState resultState,StackScrollAlgorithmState algorithmState){
  float bottomPeekStart=mInnerHeight - mBottomStackPeekSize;
  float bottomStackStart=bottomPeekStart - mBottomStackSlowDownLength;
  float currentYPosition=0.0f;
  float yPositionInScrollView=0.0f;
  int childCount=algorithmState.visibleChildren.size();
  int numberOfElementsCompletelyIn=(int)algorithmState.itemsInTopStack;
  for (int i=0; i < childCount; i++) {
    ExpandableView child=algorithmState.visibleChildren.get(i);
    StackScrollState.ViewState childViewState=resultState.getViewStateForView(child);
    childViewState.location=StackScrollState.ViewState.LOCATION_UNKNOWN;
    int childHeight=getMaxAllowedChildHeight(child);
    float yPositionInScrollViewAfterElement=yPositionInScrollView + childHeight + mPaddingBetweenElements;
    float scrollOffset=yPositionInScrollView - algorithmState.scrollY + mCollapsedSize;
    if (i == algorithmState.lastTopStackIndex + 1) {
      currentYPosition=Math.min(scrollOffset,bottomStackStart);
    }
    childViewState.yTranslation=currentYPosition;
    float nextYPosition=currentYPosition + childHeight + mPaddingBetweenElements;
    if (i <= algorithmState.lastTopStackIndex) {
      updateStateForTopStackChild(algorithmState,numberOfElementsCompletelyIn,i,childHeight,childViewState,scrollOffset);
      clampYTranslation(childViewState,childHeight);
      if (childViewState.yTranslation + childHeight + mPaddingBetweenElements >= bottomStackStart && !mIsExpansionChanging && i != 0) {
        childViewState.height=mCollapsedSize;
      }
    }
 else     if (nextYPosition >= bottomStackStart) {
      if (currentYPosition >= bottomStackStart) {
        updateStateForChildFullyInBottomStack(algorithmState,bottomStackStart,childViewState,childHeight);
      }
 else {
        updateStateForChildTransitioningInBottom(algorithmState,bottomStackStart,bottomPeekStart,currentYPosition,childViewState,childHeight);
      }
    }
 else {
      childViewState.location=StackScrollState.ViewState.LOCATION_MAIN_AREA;
      clampYTranslation(childViewState,childHeight);
    }
    if (i == 0) {
      childViewState.alpha=1.0f;
      childViewState.yTranslation=Math.max(mCollapsedSize - algorithmState.scrollY,0);
      childViewState.location=StackScrollState.ViewState.LOCATION_FIRST_CARD;
    }
    if (childViewState.location == StackScrollState.ViewState.LOCATION_UNKNOWN) {
      Log.wtf(LOG_TAG,"String_Node_Str" + i);
    }
    currentYPosition=childViewState.yTranslation + childHeight + mPaddingBetweenElements;
    yPositionInScrollView=yPositionInScrollViewAfterElement;
    childViewState.yTranslation+=mTopPadding;
  }
}

Fixed version (ground truth):
/** 
 * Determine the positions for the views. This is the main part of the algorithm.
 * @param resultState The result state to update if a change to the properties of a child occurs
 * @param algorithmState The state in which the current pass of the algorithm is currently in
 */
private void updatePositionsForState(StackScrollState resultState,StackScrollAlgorithmState algorithmState){
  float bottomPeekStart=mInnerHeight - mBottomStackPeekSize;
  float bottomStackStart=bottomPeekStart - mBottomStackSlowDownLength;
  float currentYPosition=0.0f;
  float yPositionInScrollView=0.0f;
  int childCount=algorithmState.visibleChildren.size();
  int numberOfElementsCompletelyIn=(int)algorithmState.itemsInTopStack;
  for (int i=0; i < childCount; i++) {
    ExpandableView child=algorithmState.visibleChildren.get(i);
    StackScrollState.ViewState childViewState=resultState.getViewStateForView(child);
    childViewState.location=StackScrollState.ViewState.LOCATION_UNKNOWN;
    int childHeight=getMaxAllowedChildHeight(child);
    float yPositionInScrollViewAfterElement=yPositionInScrollView + childHeight + mPaddingBetweenElements;
    float scrollOffset=yPositionInScrollView - algorithmState.scrollY + mCollapsedSize;
    if (i == algorithmState.lastTopStackIndex + 1) {
      currentYPosition=Math.min(scrollOffset,bottomStackStart);
    }
    childViewState.yTranslation=currentYPosition;
    float nextYPosition=currentYPosition + childHeight + mPaddingBetweenElements;
    if (i <= algorithmState.lastTopStackIndex) {
      updateStateForTopStackChild(algorithmState,numberOfElementsCompletelyIn,i,childHeight,childViewState,scrollOffset);
      clampYTranslation(childViewState,childHeight);
      if (childViewState.yTranslation + childHeight + mPaddingBetweenElements >= bottomStackStart && !mIsExpansionChanging && i != 0) {
        childViewState.height=mCollapsedSize;
      }
    }
 else     if (nextYPosition >= bottomStackStart) {
      if (currentYPosition >= bottomStackStart) {
        updateStateForChildFullyInBottomStack(algorithmState,bottomStackStart,childViewState,childHeight);
      }
 else {
        updateStateForChildTransitioningInBottom(algorithmState,bottomStackStart,bottomPeekStart,currentYPosition,childViewState,childHeight);
      }
    }
 else {
      childViewState.location=StackScrollState.ViewState.LOCATION_MAIN_AREA;
      clampYTranslation(childViewState,childHeight);
    }
    if (i == 0) {
      childViewState.alpha=1.0f;
      childViewState.yTranslation=Math.max(mCollapsedSize - algorithmState.scrollY,0);
      if (childViewState.yTranslation + childViewState.height > bottomPeekStart) {
        childViewState.height=(int)Math.max(bottomPeekStart - childViewState.yTranslation,mCollapsedSize);
      }
      childViewState.location=StackScrollState.ViewState.LOCATION_FIRST_CARD;
    }
    if (childViewState.location == StackScrollState.ViewState.LOCATION_UNKNOWN) {
      Log.wtf(LOG_TAG,"String_Node_Str" + i);
    }
    currentYPosition=childViewState.yTranslation + childHeight + mPaddingBetweenElements;
    yPositionInScrollView=yPositionInScrollViewAfterElement;
    childViewState.yTranslation+=mTopPadding;
  }
}