/** Constructs ESA Tables, one esa header corresponds to one esa table */
    private void yieldEsaTables() {
      //          algorithm is:
      //          1. acquire the eiaHeader of the current file;
      //          2. construct the ESA table one channel after another;
      //          3. update the status.
      int numberOfOpenedFiles = sourceFiles.size();
      ArrayList<ESATable> esaTables = new ArrayList<ESATable>(numberOfOpenedFiles);

      ESAHeader esaHeader;
      ESATable esaTable;
      for (int i = 0; i < numberOfOpenedFiles; i++) {
        // Get ESAHeader from each EDF file header
        esaHeader = MainWindow.srcEdfFileHeaders.get(i).getEsaHeader(); // 1.
        // Create ESATable using ESAHeader
        esaTable = new ESATable(esaHeader, true);
        esaTables.add(i, esaTable); // 2.
        // configure the status
        Boolean savedOnce = false; // start of 3.
        Boolean updateSinceLastSave = true;
        File workingFile = MainWindow.getWkEdfFiles().get(i);
        int cat = EDFTable.MasterHeaderCategory.ESA_WORKSET;
        esaTable.setStatesAllInOne(
            savedOnce, updateSinceLastSave, workingFile, cat, i); // end of 4.
        esaTable.setSourceMasterFile(sourceFiles.get(i)); // set source file
        // by wei wang
        //                if(readingFileCount < numberOfOpenedFiles) {
        //                	increaseReadingFileCount();
        //                }
      }
      MainWindow.setIniEsaTables(esaTables);
      MainWindow.setDupEsaTables(esaTables);
    }
  /**
   * Builds ESA table at index {@code index} in initial ESA table list , one ESA header corresponds
   * to one ESA table
   */
  private void yieldEsaTable() {
    //      algorithm is:
    //      1. acquire the eiaHeader of the current file;
    //      2. construct the ESA table one channel after another;
    //      3. update the status.
    ESATable esaTable = null;

    // need check, Fangping, 08/20/2010
    ESAHeader esaHeader = MainWindow.dupEdfFileHeaders.get(selectedEDF).getEsaHeader(); // 1.
    esaTable = new ESATable(esaHeader, true); // 2.
    // configure the status
    Boolean savedOnce = false; // start of 3.
    Boolean updateSinceLastSave = true;
    File workingFile = MainWindow.getWkEdfFiles().get(selectedEDF);
    int category = EDFTable.MasterHeaderCategory.ESA_WORKSET;
    esaTable.setStatesAllInOne(
        savedOnce, updateSinceLastSave, workingFile, category, selectedEDF); // end of 4.
    esaTable.setSourceMasterFile(sourceFiles.get(selectedEDF)); // set source file

    MainWindow.setIniEsaTable(esaTable, selectedEDF);
  }