Program: 199324
Project: 199324
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 inand which will be updated
 */
private void updatePositionsForState(StackScrollState resultState,StackScrollAlgorithmState algorithmState){
  float bottomPeekStart=mInnerHeight - mBottomStackPeekSize;
  float bottomStackStart=bottomPeekStart - mCollapsedSize;
  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) {
        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=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 inand which will be updated
 */
private void updatePositionsForState(StackScrollState resultState,StackScrollAlgorithmState algorithmState){
  float bottomPeekStart=mInnerHeight - mBottomStackPeekSize;
  float bottomStackStart=bottomPeekStart - mCollapsedSize;
  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=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;
  }
}