private void writeListErrors( FileWriter fileOut, Vector deviationMessages, Vector databaseValues, String ind, char delimeter, String variable, String value, String date, String ref, String comm) { try { if (errorList.size() > 0 || deviationMessages.size() > 0 || warningList.size() > 0) { fileOut.write("#--------------------------------------------------\n"); } if (errorList.size() > 0) { for (int i = 0; i < errorList.size(); i++) { fileOut.write("#" + (String) errorList.get(i) + "\n"); } } if (warningList.size() > 0) { for (int i = 0; i < warningList.size(); i++) { fileOut.write("#" + (String) warningList.get(i) + "\n"); } } if (deviationMessages.size() > 0) { for (int i = 0; i < deviationMessages.size(); i++) { fileOut.write("#" + (String) deviationMessages.elementAt(i) + "\n"); } // write old values fileOut.write("#" + databaseValues.elementAt(0) + "\n"); } // if there are errors, the string is "Outcommented" if (errorList.size() > 0) { fileOut.write("#"); } // write original string fileOut.write( ind + delimeter + variable + delimeter + value + delimeter + date + delimeter + ref + delimeter + comm + "\n"); if (errorList.size() > 0 || deviationMessages.size() > 0 || warningList.size() > 0) { fileOut.write("#--------------------------------------------------\n"); } } // try catch (Exception e) { e.printStackTrace(System.err); } }
/** Check if object support this format. If a match is found return true else return false */ public boolean supportFormat(FileHeader hdr) { boolean out = false; try { for (int i = 0; i < headers.size(); i++) { if ((headers.get(i).formatTypeName().equals(hdr.formatTypeName())) && (headers.get(i).objectTypeName().equals(hdr.objectTypeName())) && (headers.get(i).version() == hdr.version())) { return true; } } } catch (Exception e) { e.printStackTrace(); } return false; }
/** * @param fileOut * @param errorMessages * @param warningMessages * @param deviationMessages * @param databaseValues * @param newAlleles * @param ind * @param delim * @param marker * @param allele1 * @param allele2 */ private void writeMatrixErrors( FileWriter fileOut, Vector deviationMessages, Vector databaseValues, Vector values, String ind, char delim, String variable, String value) { try { // if row contains comments if (errorList.size() > 0 || deviationMessages.size() > 0 || warningList.size() > 0) { fileOut.write("#--------------------------------------------------------\n"); } if (errorList.size() > 0) { for (int i = 0; i < errorList.size(); i++) { fileOut.write("#" + (String) errorList.get(i) + "\n"); } } if (warningList.size() > 0) { for (int i = 0; i < warningList.size(); i++) { fileOut.write("#" + (String) warningList.get(i) + "\n"); } } if (deviationMessages.size() > 0) { for (int i = 0; i < deviationMessages.size(); i++) { fileOut.write("#" + (String) deviationMessages.elementAt(i) + "\n"); } // write database values fileOut.write("#" + ind); for (int i = 0; i < databaseValues.size(); i++) { fileOut.write(delim + (String) databaseValues.elementAt(i)); } fileOut.write("\n"); } // write row from file: if (errorList.size() > 0) { fileOut.write("#"); } fileOut.write(ind); for (int i = 0; i < values.size(); i++) { fileOut.write(delim + (String) values.elementAt(i)); } fileOut.write("\n"); /* for (int i=0;i<newAlleles.size();i++) { fileOut.write(delim+(String)newAlleles.elementAt(i)); } fileOut.write("\n"); */ // fileOut.write(delim+allele1); // fileOut.write(delim+allele2); // fileOut.write("\n"); if (errorList.size() > 0 || deviationMessages.size() > 0 || warningList.size() > 0) { fileOut.write("#--------------------------------------------------------\n"); } } // try catch (Exception e) { e.printStackTrace(System.err); } }