Program: 58398
Project: 58398
Buggy source:
@Override public void init(GL gl){
  isInitialized=true;
  ACompareViewState overviewState=compareViewStateController.getState(ECompareViewStateType.OVERVIEW);
  ACompareViewState detailViewState=compareViewStateController.getState(ECompareViewStateType.DETAIL_VIEW);
  setBar.setViewState(overviewState);
  setBar.adjustSelectionWindowSizeCentered(overviewState.getNumSetsInFocus());
  setBar.setMaxSelectedItems(overviewState.getMaxSetsInFocus());
  setBar.setMinSelectedItems(overviewState.getMinSetsInFocus());
  if (!overviewState.isInitialized()) {
    overviewState.init(gl);
  }
  overviewState.setSetsInFocus(setBar.getSetsInFocus());
  heatMapWrappers=overviewState.getHeatMapWrappers();
  ArrayList<HeatMapWrapper> sourceHeatMapWrappers=detailViewState.getHeatMapWrappers();
  int indexOffset=0;
  for (int i=0; i < heatMapWrappers.size(); i++) {
    HeatMapWrapper heatMapWrapper=heatMapWrappers.get(i);
    if (heatMapWrapper.getSet().getID() == sourceHeatMapWrappers.get(0).getSet().getID()) {
      indexOffset=i;
      break;
    }
  }
  layouts.clear();
  captionPositions.clear();
  captionTextDimensions.clear();
  captionTextSpacing.clear();
  heatMapDimensions.clear();
  heatMapPositions.clear();
  ArrayList<AHeatMapLayout> sourceLayouts=detailViewState.getLayouts();
  destinationLayouts=overviewState.getLayouts();
  ArrayList<AHeatMapLayout> focusLayouts=new ArrayList<AHeatMapLayout>();
  for (int i=0; i < sourceLayouts.size(); i++) {
    AHeatMapLayout srcLayout=sourceLayouts.get(i);
    AHeatMapLayout destLayout=destinationLayouts.get(indexOffset + i);
    HeatMapLayoutConfigurable transitionLayout=new HeatMapLayoutConfigurable(renderCommandFactory);
    transitionLayout.setLocalRenderCommands(destLayout.getRenderCommandsOfLocalItems());
    transitionLayout.setRemoteRenderCommands(destLayout.getRenderCommandsOfRemoteItems());
    focusLayouts.add(transitionLayout);
    createMovementValues(gl,indexOffset + i,srcLayout,destLayout);
    if (i == 0) {
      createOffsets(true,indexOffset + i);
    }
 else     if (i == sourceLayouts.size() - 1) {
      createOffsets(false,indexOffset + i);
    }
    srcLayout.useDendrogram(false);
  }
  for (int i=0; i < destinationLayouts.size(); i++) {
    AHeatMapLayout destLayout=destinationLayouts.get(i);
    if (i < indexOffset) {
      createMovementValuesSourceOffset(gl,i,destLayout,true);
      HeatMapLayoutConfigurable transitionLayout=new HeatMapLayoutConfigurable(renderCommandFactory);
      transitionLayout.setLocalRenderCommands(destLayout.getRenderCommandsOfLocalItems());
      transitionLayout.setRemoteRenderCommands(destLayout.getRenderCommandsOfRemoteItems());
      layouts.add(transitionLayout);
    }
 else     if (i > indexOffset + sourceLayouts.size() - 1) {
      createMovementValuesSourceOffset(gl,i,destLayout,false);
      HeatMapLayoutConfigurable transitionLayout=new HeatMapLayoutConfigurable(renderCommandFactory);
      transitionLayout.setLocalRenderCommands(destLayout.getRenderCommandsOfLocalItems());
      transitionLayout.setRemoteRenderCommands(destLayout.getRenderCommandsOfRemoteItems());
      layouts.add(transitionLayout);
    }
 else {
      layouts.add(focusLayouts.get(i - indexOffset));
    }
    HeatMapWrapper heatMapWrapper=heatMapWrappers.get(i);
    heatMapWrapper.setLayout(layouts.get(i));
    layouts.get(i).setHeatMapWrapper(heatMapWrapper);
    setsInFocus.add(heatMapWrapper.getSet());
  }
  view.setDisplayListDirty();
}

Fixed version (ground truth):
@Override public void init(GL gl){
  isInitialized=true;
  ACompareViewState overviewState=compareViewStateController.getState(ECompareViewStateType.OVERVIEW);
  ACompareViewState detailViewState=compareViewStateController.getState(ECompareViewStateType.DETAIL_VIEW);
  setBar.setViewState(overviewState);
  setBar.adjustSelectionWindowSizeCentered(overviewState.getNumSetsInFocus());
  setBar.setMaxSelectedItems(overviewState.getMaxSetsInFocus());
  setBar.setMinSelectedItems(overviewState.getMinSetsInFocus());
  if (!overviewState.isInitialized()) {
    overviewState.init(gl);
  }
  overviewState.setSetsInFocus(setBar.getSetsInFocus());
  heatMapWrappers=overviewState.getHeatMapWrappers();
  ArrayList<HeatMapWrapper> sourceHeatMapWrappers=detailViewState.getHeatMapWrappers();
  int indexOffset=0;
  for (int i=0; i < heatMapWrappers.size(); i++) {
    HeatMapWrapper heatMapWrapper=heatMapWrappers.get(i);
    if (heatMapWrapper.getSet().getID() == sourceHeatMapWrappers.get(0).getSet().getID()) {
      indexOffset=i;
      break;
    }
  }
  layouts.clear();
  captionPositions.clear();
  captionTextDimensions.clear();
  captionTextSpacing.clear();
  heatMapDimensions.clear();
  heatMapPositions.clear();
  ArrayList<AHeatMapLayout> sourceLayouts=detailViewState.getLayouts();
  destinationLayouts=overviewState.getLayouts();
  ArrayList<AHeatMapLayout> focusLayouts=new ArrayList<AHeatMapLayout>();
  for (int i=0; i < sourceLayouts.size(); i++) {
    AHeatMapLayout srcLayout=sourceLayouts.get(i);
    AHeatMapLayout destLayout=destinationLayouts.get(indexOffset + i);
    HeatMapLayoutConfigurable transitionLayout=new HeatMapLayoutConfigurable(renderCommandFactory);
    transitionLayout.setLocalRenderCommands(destLayout.getRenderCommandsOfLocalItems());
    transitionLayout.setRemoteRenderCommands(destLayout.getRenderCommandsOfRemoteItems());
    transitionLayout.setGroupPickingType(destLayout.getGroupPickingType());
    focusLayouts.add(transitionLayout);
    createMovementValues(gl,indexOffset + i,srcLayout,destLayout);
    if (i == 0) {
      createOffsets(true,indexOffset + i);
    }
 else     if (i == sourceLayouts.size() - 1) {
      createOffsets(false,indexOffset + i);
    }
    srcLayout.useDendrogram(false);
  }
  for (int i=0; i < destinationLayouts.size(); i++) {
    AHeatMapLayout destLayout=destinationLayouts.get(i);
    if (i < indexOffset) {
      createMovementValuesSourceOffset(gl,i,destLayout,true);
      HeatMapLayoutConfigurable transitionLayout=new HeatMapLayoutConfigurable(renderCommandFactory);
      transitionLayout.setLocalRenderCommands(destLayout.getRenderCommandsOfLocalItems());
      transitionLayout.setRemoteRenderCommands(destLayout.getRenderCommandsOfRemoteItems());
      transitionLayout.setGroupPickingType(destLayout.getGroupPickingType());
      layouts.add(transitionLayout);
    }
 else     if (i > indexOffset + sourceLayouts.size() - 1) {
      createMovementValuesSourceOffset(gl,i,destLayout,false);
      HeatMapLayoutConfigurable transitionLayout=new HeatMapLayoutConfigurable(renderCommandFactory);
      transitionLayout.setLocalRenderCommands(destLayout.getRenderCommandsOfLocalItems());
      transitionLayout.setRemoteRenderCommands(destLayout.getRenderCommandsOfRemoteItems());
      transitionLayout.setGroupPickingType(destLayout.getGroupPickingType());
      layouts.add(transitionLayout);
    }
 else {
      layouts.add(focusLayouts.get(i - indexOffset));
    }
    HeatMapWrapper heatMapWrapper=heatMapWrappers.get(i);
    heatMapWrapper.setLayout(layouts.get(i));
    layouts.get(i).setHeatMapWrapper(heatMapWrapper);
    setsInFocus.add(heatMapWrapper.getSet());
  }
  view.setDisplayListDirty();
}