All pastes #709681 Raw Edit

Miscellany

public text v1 · immutable
#709681 ·published 2007-09-24 21:37 UTC
rendered paste body
 private Map<SFVFile, LinkedRemoteFileInterface> findIncompleteSFVs(Collection<SectionInterface> sections) {
    Map<SFVFile, LinkedRemoteFileInterface> incompleteSfv = new HashMap<SFVFile, LinkedRemoteFileInterface>();
    List<LinkedRemoteFileInterface> uncheckedDirs = new ArrayList<LinkedRemoteFileInterface>();

    //add all dirs in sections
    for (SectionInterface section : sections) {
      uncheckedDirs.addAll(section.getBaseFile().getDirectories());
    }

    //check for subdirs to process and add all non complete sfvfiles
    while (!uncheckedDirs.isEmpty()) {
      LinkedRemoteFileInterface file = uncheckedDirs.remove(0);

      try {
        SFVFile sfv = file.lookupSFVFile();
        if (sfv != null && !sfv.getStatus().isFinished())
          incompleteSfv.put(sfv, file);

      } catch (FileNotFoundException e) {
        //no sfv, ignore that
      } catch (IOException e) {
        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
      } catch (NoAvailableSlaveException e) {
        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
      }

      if (file.isDirectory()) {
        uncheckedDirs.addAll(file.getDirectories());
      }
    }

    return incompleteSfv;