private int numPropagatedImageReferences(ImageToProcess img,Set<TaskImageContainer> tasks) throws RuntimeException {
  int countImageRefs=0;
  for (  TaskImageContainer task : tasks) {
    if (task.mImage != null && task.mImage != img) {
      throw new RuntimeException("ERROR:  Spawned tasks cannot reference new images!");
    }
    if (task.mImage != null) {
      countImageRefs++;
    }
  }
  return countImageRefs;
}

private int numPropagatedImageReferences ( ImageToProcess img , Set < TaskImageContainer > tasks ) throws RuntimeException { int countImageRefs = 0 ; for ( TaskImageContainer task : tasks ) { if ( task . mImage != null && task . mImage != img ) { throw new RuntimeException ( "ERROR:  Spawned tasks cannot reference new images!" ) ; } if ( task . mImage != null ) { countImageRefs ++ ; } } return countImageRefs ; }
calculates the number of new image references in a set of dependent tasks . checks to make sure no new image references are being introduced .
