Program: 51808
Project: 51808
Buggy source:
private void constrainDecisions(boolean movingTowardStart){
  boolean moved=false;
  do {
    moved=false;
    for (    AbstractComponent child : getComponents()) {
      if (child instanceof DecisionComponent) {
        long start=((DecisionComponent)child).getStart();
        long end=((DecisionComponent)child).getEnd();
        DurationCapability preceedingCapability=null;
        DurationCapability followingCapability=null;
        long nearestPrecedent=getStart();
        long nearestFollower=getEnd();
        for (        AbstractComponent otherChild : getComponents()) {
          if (child != otherChild) {
            DurationCapability dc=otherChild.getCapability(DurationCapability.class);
            if (dc.getEnd() > nearestPrecedent && dc.getEnd() <= end) {
              preceedingCapability=dc;
              nearestPrecedent=dc.getEnd();
            }
            if (dc.getStart() < nearestFollower && dc.getStart() >= start) {
              followingCapability=dc;
              nearestFollower=dc.getStart();
            }
          }
        }
        if (preceedingCapability != null && nearestPrecedent < start && !overlaps((DurationCapability)child,preceedingCapability)) {
          long delta=(start - nearestPrecedent) * (movingTowardStart ? -1 : 1);
          DurationCapability toMove=(DurationCapability)(movingTowardStart ? child : preceedingCapability);
          toMove.setStart(toMove.getStart() + delta);
          toMove.setEnd(toMove.getEnd() + delta);
          moved=true;
        }
        if (followingCapability != null && nearestFollower > end && !overlaps((DurationCapability)child,followingCapability)) {
          long delta=(end - nearestFollower) * (movingTowardStart ? 1 : -1);
          DurationCapability toMove=(DurationCapability)(!movingTowardStart ? child : followingCapability);
          toMove.setStart(toMove.getStart() + delta);
          toMove.setEnd(toMove.getEnd() + delta);
          moved=true;
        }
      }
    }
  }
 while (moved);
}

Fixed version (ground truth):
private void constrainDecisions(boolean movingTowardStart){
  boolean moved=false;
  do {
    moved=false;
    for (    AbstractComponent child : getComponents()) {
      if (child instanceof DecisionComponent) {
        long start=((DecisionComponent)child).getStart();
        long end=((DecisionComponent)child).getEnd();
        DurationCapability preceedingCapability=null;
        DurationCapability followingCapability=null;
        long nearestPrecedent=getStart();
        long nearestFollower=getEnd();
        for (        AbstractComponent otherChild : getComponents()) {
          if (child != otherChild) {
            DurationCapability dc=otherChild.getCapability(DurationCapability.class);
            if (dc.getEnd() > nearestPrecedent && dc.getEnd() <= start) {
              preceedingCapability=dc;
              nearestPrecedent=dc.getEnd();
            }
            if (dc.getStart() < nearestFollower && dc.getStart() >= end) {
              followingCapability=dc;
              nearestFollower=dc.getStart();
            }
          }
        }
        if (preceedingCapability != null && nearestPrecedent < start && !overlaps((DurationCapability)child,preceedingCapability)) {
          long delta=(start - nearestPrecedent) * (movingTowardStart ? -1 : 1);
          DurationCapability toMove=(DurationCapability)(movingTowardStart ? child : preceedingCapability);
          toMove.setStart(toMove.getStart() + delta);
          toMove.setEnd(toMove.getEnd() + delta);
          moved=true;
        }
        if (followingCapability != null && nearestFollower > end && !overlaps((DurationCapability)child,followingCapability)) {
          long delta=(end - nearestFollower) * (movingTowardStart ? 1 : -1);
          DurationCapability toMove=(DurationCapability)(!movingTowardStart ? child : followingCapability);
          toMove.setStart(toMove.getStart() + delta);
          toMove.setEnd(toMove.getEnd() + delta);
          moved=true;
        }
      }
    }
  }
 while (moved);
}