private void readtblfirma() {
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(ConverterExecutor.class.getResourceAsStream("tblfirma.csv")));
      List<String[]> input = reader.readAll();

      for (String[] values : input) {
        String id = values[0];
        String firma = values[1];
        String brancheId = values[2];
        String size = values[3];

        Company comp = new Company();
        comp.setId(Long.parseLong(id));
        comp.setCompany(firma);
        comp.setSize(size);

        Sector sec = sectorDao.findById(Long.parseLong(brancheId));
        comp.setSector(sec);

        companyDao.persist(comp);

        companyId_company.put(comp.getId(), comp);
      }

      reader.close();
    } catch (RuntimeException e) {

    } catch (IOException ioe) {

    }
  }
Ejemplo n.º 2
0
  public void printStock() throws NumberFormatException, IOException {
    Reader changed;

    InputStream input =
        new URL(
                "http://finance.yahoo.com/d/quotes.csv?s="
                    + this.name.toUpperCase()
                    + "&f=nsl1ocghjkr")
            .openStream();
    changed = new InputStreamReader(input, "UTF-8");

    CSVReader reader = new CSVReader(changed);
    String[] nextLine;

    while ((nextLine = reader.readNext()) != null) {
      System.out.println("\nCompany: " + nextLine[0] + "(" + nextLine[1] + ")\n");
      System.out.println("\tPrice: " + nextLine[2]);
      System.out.println("\tOpen: " + nextLine[3]);
      System.out.println("\tChange: " + nextLine[4]);
      System.out.println("\tDay's Low: " + nextLine[5]);
      System.out.println("\tDay's High: " + nextLine[6]);
      System.out.println("\t52 Week Low: " + nextLine[7]);
      System.out.println("\t52 Week High: " + nextLine[8]);
      System.out.println("\tP/E Ratio: " + nextLine[9]);
    }
    reader.close();

    System.out.println("\n\tBought at: $" + this.initialPrice);
    System.out.println("\n\tShares owned: " + this.shares);
    System.out.println("\n\tCurrent earnings: $" + this.earnings);
  }
  private void readtblbranche() {
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(ConverterExecutor.class.getResourceAsStream("tblbranche.csv")));
      List<String[]> input = reader.readAll();

      for (String[] values : input) {
        String id = values[0];
        String branche = values[1];

        Sector sec = new Sector();
        sec.setId(Long.parseLong(id));
        sec.setSector(branche);
        sectorDao.persist(sec);

        sectorId_sector.put(sec.getId(), sec);
      }

      reader.close();
    } catch (RuntimeException e) {

    } catch (IOException ioe) {

    }
  }
  @Test
  public void testZeroRhoScoreWithoutPreviousCoverage() throws IOException {

    EvoSuite evosuite = new EvoSuite();

    String targetClass = Compositional.class.getCanonicalName();
    Properties.TARGET_CLASS = targetClass;

    Properties.OUTPUT_VARIABLES = RuntimeVariable.RhoScore.name();
    Properties.STATISTICS_BACKEND = StatisticsBackend.CSV;

    String[] command = new String[] {"-class", targetClass, "-generateTests"};

    Object result = evosuite.parseCommandLine(command);
    Assert.assertNotNull(result);

    List<?> goals = RhoCoverageFactory.getGoals();
    assertEquals(11, goals.size());

    String statistics_file =
        System.getProperty("user.dir")
            + File.separator
            + Properties.REPORT_DIR
            + File.separator
            + "statistics.csv";

    CSVReader reader = new CSVReader(new FileReader(statistics_file));
    List<String[]> rows = reader.readAll();
    assertTrue(rows.size() == 2);
    reader.close();

    assertEquals("0.5", rows.get(1)[0]);
  }
Ejemplo n.º 5
0
  /**
   * Public constructor of an AirportParser object. Reads a .csv file with airport information and
   * fills the airportMap with the mapping information.
   *
   * @param filename The path to the file to read from.
   */
  public AirportParser(String filename) {
    try {
      airportMap = new HashMap<String, Airport>();
      CSVReader reader = new CSVReader(new FileReader(filename), ',');
      String[] airportRecord = null;
      reader.readNext();
      while ((airportRecord = reader.readNext()) != null) {
        Airport airport = new Airport();
        airport.setId(Integer.parseInt(airportRecord[0]));
        airport.setIdent(airportRecord[1]);
        airport.setType(airportRecord[2]);
        airport.setName(airportRecord[3]);
        airport.setIso_country(airportRecord[8]);
        airportMap.put(airport.getIdent(), airport);
      }

      reader.close();

    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  private void readtblabschluss() {
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(
                  ConverterExecutor.class.getResourceAsStream("tblabschluss.csv")));
      List<String[]> input = reader.readAll();

      for (String[] values : input) {
        String id = values[0];
        String longname = values[1];
        String shortname = values[2];

        Degree deg = new Degree();
        deg.setId(Long.parseLong(id));
        deg.setShortForm(shortname);
        deg.setTitle(longname);
        degreeDao.persist(deg);

        degreeId_degree.put(deg.getId(), deg);
      }

      reader.close();

    } catch (RuntimeException e) {
      throw e;
    } catch (IOException ioe) {

    }
    // CSVReader reader = new CSVReader(new )

  }
Ejemplo n.º 7
0
 public void close() {
   try {
     reader.close();
   } catch (IOException e) {
     throw new RuntimeException("Error closing CSV reader", e);
   }
 }
Ejemplo n.º 8
0
  public void updateStock() throws MalformedURLException, IOException {
    Reader changed;

    InputStream input =
        new URL(
                "http://finance.yahoo.com/d/quotes.csv?s="
                    + this.name.toUpperCase()
                    + "&f=nsl1ocghjkr")
            .openStream();
    changed = new InputStreamReader(input, "UTF-8");

    CSVReader reader = new CSVReader(changed);
    String[] nextLine = reader.readNext();

    // Store the stock opening and last prices
    this.openPrice = Double.parseDouble(nextLine[3]);
    this.lastPrice = Double.parseDouble(nextLine[2]);

    double currprice = Double.parseDouble(nextLine[2]);
    this.earnings = this.shares * (currprice - initialPrice);

    // Calculate and store the percent change for the stock
    this.percentChanged = (this.lastPrice - this.openPrice) / this.openPrice;

    reader.close();
    input.close();
  }
Ejemplo n.º 9
0
 public boolean moveNext() {
   try {
     outer:
     for (; ; ) {
       final String[] strings = reader.readNext();
       if (strings == null) {
         current = null;
         reader.close();
         return false;
       }
       if (filterValues != null) {
         for (int i = 0; i < strings.length; i++) {
           String filterValue = filterValues[i];
           if (filterValue != null) {
             if (!filterValue.equals(strings[i])) {
               continue outer;
             }
           }
         }
       }
       current = rowConverter.convertRow(strings);
       return true;
     }
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
  @Override
  public Object deserialize(final Writable blob) throws SerDeException {
    Text rowText = (Text) blob;

    CSVReader csv = null;
    try {
      csv =
          newReader(
              new CharArrayReader(rowText.toString().toCharArray()),
              separatorChar,
              quoteChar,
              escapeChar);
      final String[] read = csv.readNext();

      for (int i = 0; i < numCols; i++) {
        if (read != null && i < read.length) {
          row.set(i, read[i]);
        } else {
          row.set(i, null);
        }
      }

      return row;
    } catch (final Exception e) {
      throw new SerDeException(e);
    } finally {
      if (csv != null) {
        try {
          csv.close();
        } catch (final Exception e) {
          // ignore
        }
      }
    }
  }
  private void readtbltaetigkeit() {
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(
                  ConverterExecutor.class.getResourceAsStream("tbltaetigkeit.csv")));
      List<String[]> input = reader.readAll();

      for (String[] values : input) {
        String id = values[0];
        String taetigkeit = values[1];

        Activity act = new Activity();
        act.setId(Long.parseLong(id));
        act.setActivity(taetigkeit);
        activityDao.persist(act);

        activityId_activity.put(act.getId(), act);
      }

      reader.close();
    } catch (RuntimeException e) {

    } catch (IOException ioe) {

    }
  }
Ejemplo n.º 12
0
  public String readPackageName(InputStream in) throws ServiceException {
    String packageName = null;

    CSVReader reader;
    try {
      reader = new CSVReader(new InputStreamReader(in));

      String[] firstLine = reader.readNext();

      if (firstLine != null) {

        String[] nextLine = null;

        while ((nextLine = reader.readNext()) != null) {

          packageName = nextLine[0];
        }
      }
      reader.close();

    } catch (FileNotFoundException e) {
      throw new ServiceException(e);
    } catch (IOException e) {
      throw new ServiceException(e);
    }

    return packageName;
  }
  private void process(String[] folders) throws Exception {

    FileOutputStream fos = new FileOutputStream(_outPath);
    BufferedOutputStream x = new BufferedOutputStream(fos);
    OutputStreamWriter out = new OutputStreamWriter(x);

    for (int i = 0; i < folders.length; i++) {

      String filePath = _inPath + folders[i] + "/Memory.csv";
      System.out.println(filePath);
      String temp = filePath + "_Cleaned";
      GenerateThroughput.cleanUp(filePath, temp, true);

      CSVReader reader = new CSVReader(new FileReader(temp));
      String[] nextLine;
      double maxTime = -1;
      // Find the max time
      while ((nextLine = reader.readNext()) != null) {
        for (int j = 0; j < nextLine.length / 4; j++) {
          try {
            if (maxTime < Double.parseDouble(nextLine[4 * j + 3])) {
              maxTime = Double.parseDouble(nextLine[4 * j + 3]);
            }
          } catch (Exception e) {
          }
        }
      }
      reader.close();
      out.write(folders[i] + "," + maxTime + '\n');
    }
    out.close();
    x.close();
    fos.close();
  }
Ejemplo n.º 14
0
 protected static int readNLines(String filename) throws IOException {
   CSVReader reader = new CSVReader(new FileReader(filename));
   int n = 0;
   while (reader.readNext() != null) n++;
   reader.close();
   return n;
 }
Ejemplo n.º 15
0
 /** Deduces the names and types of a table's columns by reading the first line of a CSV file. */
 static RelDataType deduceRowType(
     JavaTypeFactory typeFactory, File file, List<CsvFieldType> fieldTypes) {
   final List<RelDataType> types = new ArrayList<RelDataType>();
   final List<String> names = new ArrayList<String>();
   CSVReader reader = null;
   try {
     reader = openCsv(file);
     final String[] strings = reader.readNext();
     for (String string : strings) {
       final String name;
       final CsvFieldType fieldType;
       final int colon = string.indexOf(':');
       if (colon >= 0) {
         name = string.substring(0, colon);
         String typeString = string.substring(colon + 1);
         fieldType = CsvFieldType.of(typeString);
         if (fieldType == null) {
           System.out.println(
               "WARNING: Found unknown type: "
                   + typeString
                   + " in file: "
                   + file.getAbsolutePath()
                   + " for column: "
                   + name
                   + ". Will assume the type of column is string");
         }
       } else {
         name = string;
         fieldType = null;
       }
       final RelDataType type;
       if (fieldType == null) {
         type = typeFactory.createJavaType(String.class);
       } else {
         type = fieldType.toType(typeFactory);
       }
       names.add(name);
       types.add(type);
       if (fieldTypes != null) {
         fieldTypes.add(fieldType);
       }
     }
   } catch (IOException e) {
     // ignore
   } finally {
     if (reader != null) {
       try {
         reader.close();
       } catch (IOException e) {
         // ignore
       }
     }
   }
   if (names.isEmpty()) {
     names.add("line");
     types.add(typeFactory.createJavaType(String.class));
   }
   return typeFactory.createStructType(Pair.zip(names, types));
 }
  /**
   * Validates the structure of the merged csv files.
   *
   * @param mFiles List of MasterFiles to check
   * @return Returns true if the data structure of all given files matches. Throws an user exception
   *     (MergeException) otherwise.
   * @throws MergeException
   */
  public static boolean dataStructureMatch(List<MasterFile> mFiles) throws MergeException {
    String[] headers = null;
    String headerLine = "";
    String currFile = "";
    BufferedReader reader;
    FileInputStream fis;
    boolean firstRun = true;
    try {
      int maxHeaderSize = 0;
      for (MasterFile mFile : mFiles) {
        String fPath = mFile.getLocalAbsolutePath();
        currFile = fPath;

        File csvFile = new File(fPath);
        FileReader freader = new FileReader(csvFile);
        CSVReader csvreader = new CSVReader(freader, '\t', CSVWriter.NO_QUOTE_CHARACTER);
        headers = csvreader.readNext();
        if (headers != null) {
          if (headers.length != maxHeaderSize) {

            maxHeaderSize = headers.length;
            // get header line
            fis = new FileInputStream(fPath);
            reader = new BufferedReader(new InputStreamReader(fis));
            headerLine = reader.readLine();
            reader.close();
            if (!firstRun) {
              throw new MergeException(
                  "Data structure has changed within the given interval. File:"
                      + mFile.getName()
                      + "; Time tag of the file:"
                      + mFile.getCreated()
                      + ". The number of columns has changed.",
                  1);
            }
            firstRun = false;
          }

        } else {
          throw new MergeException("Error reading csv file header: " + currFile, 1);
        }
        csvreader.close();
      }
      if (maxHeaderSize == 0 || headerLine.equals("")) {
        throw new MergeException("Zero length header in csv file!", 1);
      }
      return true;

    } catch (FileNotFoundException ex) {
      throw new MergeException("CSV file not found. " + currFile + " " + ex.getMessage(), 1);
    } catch (IOException ex) {
      throw new MergeException("Error reading csv file: " + currFile + " " + ex.getMessage(), 1);
    }
  }
 /**
  * Shutdown the plugin.
  *
  * @throws HarvesterException if an error occurred
  */
 @Override
 public void shutdown() throws HarvesterException {
   if (csvReader != null) {
     try {
       csvReader.close();
     } catch (IOException ioe) {
       log.warn("Failed to close CSVReader!", ioe);
     }
     csvReader = null;
   }
 }
Ejemplo n.º 18
0
 private long readEndTime(File file) throws Exception {
   CSVReader reader =
       new CSVReader(new FileReader(file), SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER, '\'');
   try {
     String[] firstLine = reader.readNext();
     if ("start".equals(firstLine[0]) && "end".equals(firstLine[2])) {
       return Long.parseLong(firstLine[3]);
     }
   } finally {
     reader.close();
   }
   return 0;
 }
Ejemplo n.º 19
0
  public static List<String[]> csvToArray(String path, char separator) {
    List<String[]> list = null;
    CSVReader reader = null;

    try {
      reader = new CSVReader(new InputStreamReader(new FileInputStream(path), "CP1256"), separator);
      list = reader.readAll();
      reader.close();
    } catch (IOException e) {
      e.printStackTrace();
    }

    return list;
  }
Ejemplo n.º 20
0
 @Override
 public void execute(FunctionContext context) throws Exception {
   String[] csvParameters = this.csvReader.readNext();
   if (csvParameters == null) {
     csvReader.close();
     initializeCSVReader(context);
     csvParameters = this.csvReader.readNext();
   }
   if (csvParameters != null) {
     for (int headerI = 0; headerI < headers.length; headerI++) {
       context.addParameter(headers[headerI], csvParameters[headerI]);
     }
   }
 }
Ejemplo n.º 21
0
 public static void calculateOverlap(String file1, String file2, String outFile)
     throws IOException {
   CSVReader csvReader = new CSVReader(new FileReader(new File(file1)));
   List<String[]> file1Lines = csvReader.readAll();
   csvReader.close();
   csvReader = new CSVReader(new FileReader(new File(file2)));
   List<String[]> file2Lines = csvReader.readAll();
   Map<String, Object> cache = new HashMap<String, Object>();
   csvReader.close();
   for (String[] columns : file2Lines) {
     cache.put(columns[0], null);
   }
   CSVWriter csvWriter = new CSVWriter(new FileWriter(new File(outFile)));
   for (String[] columns : file1Lines) {
     if (cache.containsKey(columns[0])) {
       csvWriter.writeNext(new String[] {columns[0], "MATCH"});
     } else {
       csvWriter.writeNext(new String[] {columns[0], "NO_MATCH"});
     }
   }
   csvWriter.flush();
   csvWriter.close();
 }
  private void readtblrelmitgliedtaetigkeit() {
    Map<Long, Set<Activity>> memberId_activites = new HashMap<Long, Set<Activity>>();
    List<Member> members = new ArrayList<Member>();
    try {
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(
                  ConverterExecutor.class.getResourceAsStream("tblrelmitgliedtaetigkeit.csv")));
      List<String[]> input = reader.readAll();
      int line = 0;
      for (String[] values : input) {
        System.out.println("Reading line " + line);
        line++;
        String mitgliedId = values[0];
        String taetigkeitId = values[1];

        System.out.println("MitgliedId " + mitgliedId);
        System.out.println("TätigkeitId " + taetigkeitId);

        if (memberId_activites.get(Long.parseLong(mitgliedId)) == null) {
          Set<Activity> activites = new HashSet<Activity>();
          activites.add(activityId_activity.get(Long.parseLong(taetigkeitId)));
          memberId_activites.put(Long.parseLong(mitgliedId), activites);
        } else {
          memberId_activites
              .get(Long.parseLong(mitgliedId))
              .add(activityId_activity.get(Long.parseLong(taetigkeitId)));
        }
      }

      // memberDao.persistAll(members);
      reader.close();
      System.out.println("Before Persiting");
      for (Long memberId : memberId_activites.keySet()) {
        Member member = memberId_member.get(memberId);
        member.setActivities(memberId_activites.get(memberId));
        members.add(member);
      }

      memberDao.persistAll(members);

    } catch (RuntimeException e) {
      e.printStackTrace();
      System.out.println("Error " + e);
      throw e;
    } catch (IOException ioe) {

    }
  }
 void loadMappingFile() throws DataRetrievalException, ValidationException {
   try {
     CSVReader reader = new CSVReader(new FileReader(getMappingFile()));
     String[] fields;
     while ((fields = Cai2Util.readDataLine(reader)) != null) {
       processMappingData(fields);
     }
     reader.close();
   } catch (FileNotFoundException e) {
     throw new DataRetrievalException("Sample mapping file not found: ", e);
   } catch (IOException e) {
     throw new DataRetrievalException("Couldn't read sample mapping file: ", e);
   } catch (ConnectionException e) {
     throw new DataRetrievalException("Couldn't connect to caArray: ", e);
   }
 }
  private void readtblrelmitgliedbranche() {
    List<Member> membersDb = memberDao.findAll();
    Map<Long, Member> cMemberId_member = new HashMap<Long, Member>();

    for (Member mem : membersDb) {
      cMemberId_member.put(mem.getId(), mem);
    }

    try {
      membersDb.clear();
      CSVReader reader =
          new CSVReader(
              new InputStreamReader(
                  ConverterExecutor.class.getResourceAsStream("tblrelmitgliedbranche.csv")));
      List<String[]> input = reader.readAll();
      for (String[] values : input) {
        String mitgliedId = values[0];
        String brancheId = values[1];
        String abteilungId = values[2];

        Member mem = cMemberId_member.get(Long.parseLong(mitgliedId));
        mem.setSector(sectorId_sector.get(Long.parseLong(brancheId)));
        try {
          mem.setDepartment(departmentId_department.get(Long.parseLong(abteilungId)));
        } catch (NumberFormatException nfe) {
          System.out.println("NFE");
        }

        membersDb.add(mem);
      }

      reader.close();
      System.out.println("Ready with Branche und Abteilung.");

      memberDao.persistAll(membersDb);

    } catch (RuntimeException e) {
      e.printStackTrace();
      System.out.println("Error " + e);
      throw e;
    } catch (IOException ioe) {

    }
  }
  /**
   * Initialer Aufruf, der die Datei parst. Wird von den Implementierungen der Interfaces
   * aufgerufen.
   *
   * @param in InputStream für die einzulesende Datei
   */
  protected void parseDatei(InputStream in) throws IOException {
    // Momentan statisch mit Semikolon als Delimiter
    reader = new CSVReader(new InputStreamReader(in, "ISO-8859-1"), ';');
    String[] curLine;
    aktuelleZeile = beginneBeiZeile;
    for (int i = 0; i < beginneBeiZeile; i++) {
      curLine = reader.readNext();
    }
    while (null != (curLine = reader.readNext())) {
      if (curLine.length > 1) {
        this.parseZeile(curLine);
      }
      aktuelleZeile++;
    }

    // Am Schluss:
    reader.close();
    this.dateiendeErreicht();
  }
Ejemplo n.º 26
0
  /** *************************************************** */
  public static RegressionInputs loadRegressionCsv(String filename) throws IOException {
    CSVReader reader = new CSVReader(new FileReader(filename));
    String[] nextLine;

    Vector<svm_node[]> x = new Vector<svm_node[]>();
    Vector<Double> y = new Vector<Double>();
    while ((nextLine = reader.readNext()) != null) {
      int m = nextLine.length;

      svm_node[] xk = new svm_node[m - 1];
      for (int i = 0; i < m - 1; i++)
        xk[i] = Conversion.toVector(i, Double.parseDouble(nextLine[i]));

      x.add(xk);
      y.add(Double.parseDouble(nextLine[m - 1]));
    }
    reader.close();
    return new RegressionInputs(x, y);
  }
Ejemplo n.º 27
0
 // If master list does exist then read the master list CSV file back in and print it out
 public List<ParsedPointOfInterest> loadCSVFile(String fileName) {
   List<ParsedPointOfInterest> myList = new ArrayList<ParsedPointOfInterest>();
   FileInputStream input;
   try {
     input = openFileInput(fileName);
     InputStreamReader reader = new InputStreamReader(input);
     CSVReader csvReader = new CSVReader(reader);
     String columns[];
     while ((columns = csvReader.readNext()) != null) {
       ParsedPointOfInterest poi = ParsedPointOfInterest.create(columns);
       myList.add(poi);
     }
     csvReader.close();
     reader.close();
   } catch (IOException e) {
     e.printStackTrace();
   }
   return myList;
 }
Ejemplo n.º 28
0
 // If master list does not exist then parse and load original template
 public List<ParsedPointOfInterest> loadTemplateFile(String fileName) {
   List<ParsedPointOfInterest> myList = new ArrayList<ParsedPointOfInterest>();
   InputStream assetStream;
   try {
     assetStream = getAssets().open(fileName);
     InputStreamReader reader = new InputStreamReader(assetStream);
     CSVReader csvReader = new CSVReader(reader);
     String columns[];
     while ((columns = csvReader.readNext()) != null) {
       ParsedPointOfInterest poi = ParsedPointOfInterest.create(columns);
       myList.add(poi); // LOOK INTO THIS!!!!!!!!
     }
     csvReader.close();
     reader.close();
   } catch (IOException e) {
     e.printStackTrace();
   }
   return myList;
 }
Ejemplo n.º 29
0
  /**
   * Creates a map from the ChEBI Compounds resources of secondary to primary parentMap.
   *
   * @throws IOException problem reading file
   * @throws MissingLocationException if ChEBI Compounds resource location is missing
   */
  public void createMap() throws IOException, MissingLocationException {

    ResourceFileLocation location = getLocation("ChEBI Compounds");
    CSVReader csv = new CSVReader(new InputStreamReader(location.open()), '\t');

    List<String> header = Arrays.asList(csv.readNext());
    int accessionIndex = header.indexOf("CHEBI_ACCESSION");
    int parentIndex = header.indexOf("PARENT_ID");
    int statusIndex = header.indexOf("STATUS");

    Pattern NULL_PATTERN = Pattern.compile("null");
    Pattern ACCESSION_PATTERN = Pattern.compile("(?:C[hH]EBI:)?(\\d+)");

    String[] row = null;
    while ((row = csv.readNext()) != null) {

      String accession = row[accessionIndex];
      String parent = row[parentIndex];
      Character status = row[statusIndex].charAt(0);

      Matcher accessionMatcher = ACCESSION_PATTERN.matcher(accession);
      Matcher parentMatcher = ACCESSION_PATTERN.matcher(parent);

      if (accessionMatcher.find()) {

        String childAcc = accessionMatcher.group(1);
        String parentAcc = parentMatcher.find() ? parentMatcher.group(1) : childAcc;

        childMap.put(parentAcc, "CHEBI:" + childAcc);
        childMap.put("CHEBI:" + parentAcc, "CHEBI:" + childAcc);

        parentMap.put(childAcc, "CHEBI:" + parentAcc);
        parentMap.put("CHEBI:" + childAcc, "CHEBI:" + parentAcc);

        statusMap.put(childAcc, status);
        statusMap.put("CHEBI:" + childAcc, status);
      }
    }

    location.close();
    csv.close();
  }
  /**
   * @param filePaths - list of files to merge
   * @return header line with the most columns
   * @throws Exception
   */
  private static String getLongestHeaders(List<MasterFile> mFiles) throws Exception {
    String[] headers = null;
    String headerLine = "";
    String currFile = "";
    BufferedReader reader;
    FileInputStream fis;
    try {
      int maxHeaderSize = 0;
      for (MasterFile mFile : mFiles) {
        String fPath = mFile.getLocalAbsolutePath();
        currFile = fPath;

        File csvFile = new File(fPath);
        FileReader freader = new FileReader(csvFile);
        CSVReader csvreader = new CSVReader(freader, '\t', CSVWriter.NO_QUOTE_CHARACTER);
        headers = csvreader.readNext();
        if (headers != null) {
          if (headers.length > maxHeaderSize) {
            maxHeaderSize = headers.length;
            // get header line
            fis = new FileInputStream(fPath);
            reader = new BufferedReader(new InputStreamReader(fis));
            headerLine = reader.readLine();
            reader.close();
          }

        } else {
          throw new Exception("Error reading csv file header: " + currFile);
        }
        csvreader.close();
      }
      if (maxHeaderSize == 0 || headerLine.equals("")) {
        throw new Exception("Zero length header in csv file!");
      }
      return headerLine;

    } catch (FileNotFoundException ex) {
      throw new Exception("CSV file not found. " + currFile + " " + ex.getMessage());
    } catch (IOException ex) {
      throw new Exception("Error reading csv file: " + currFile + " " + ex.getMessage());
    }
  }