/** Function that stores the trial's results on the correct file. */ public void storeInformationInFile() { // Check to see if the file where the results will be stored already exists. if (fileToStoreInfoPath.equals("")) { // Create file fileToStoreInfoPath = createStoreFile(); } File fileToWrite = new File(fileToStoreInfoPath); if (!fileToWrite.exists()) { System.err.println( "File where information was to be stored does not exist.\nAs such no results will be saved."); return; } try { Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(fileToWrite, true), "UTF8")); // Fill the columns with the respective information for (int w = 0; w < path.size(); w++) { int mousePositionX = path.get(w).getXCoordinate(); int mousePositionY = path.get(w).getYCoordinate(); writer.write( device + " " + userId + " " + blockNumber + " " + (sequenceNumber + 1) + " " + numberOfClicks + " " + numberOfCircles + " " + circleId + " " + distanceBetweenCirclesAndFrameCenter + " " + startingCircleCenter.toString() + " " + endingCircleCenter.toString() + " " + targetWidth + " " + elapsedTime + " " + mousePositionX + " " + mousePositionY + "\n"); } writer.close(); } catch (Exception e) { System.err.println( "It was not possible to write to the inteded file.\nResults have been lost."); e.printStackTrace(); System.exit(0); } }