<commit_before>

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.nio.file.Path;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class GeoLifeUser  extends GeoLifeEntity {
	private String userID;
	List<GeoLifeFile> pltFiles;
	private Scanner plt_scanner;
	
	public GeoLifeUser(Path root, String userID) throws FileNotFoundException, ParseException {
		this.userID = userID;
		initPltFiles(root);

		minX = minY = Double.MAX_VALUE;	// All values are smaller than Double.MAX_VALUE.
		maxX = maxY = Double.MIN_VALUE; // All values are bigger than Double.MIN_VALUE.
		minTime = Integer.MAX_VALUE;
		maxTime = Integer.MIN_VALUE;	
	}
	
	private void initPltFiles(Path root) {
		// Create a path representing where the individual PLT files are located.
		//  It is expected this path will look like:
		//  /some/given/path/Data/<userID>/Trajectory/
		Path dataFilesDirectory = root.resolve(userID).resolve("Trajectory");
		
		// Find all plt filenames inside this directory.
		String[] pltFilenames = dataFilesDirectory.toFile().list(new FilenameFilter() {
          @Override
          public boolean accept(File dir, String name) {
            return name.endsWith("plt");
          }
        });
		
		System.out.printf("%d files found for user %s\n", pltFilenames.length, userID);
		List<String> files = Arrays.asList(pltFilenames);
		// Sort files such that the first file is the earliest one created.
		//  The sorting below is accomplished through lexicographical sorting
		//  based on the file paths. Since file names are in the format
		//		20081023025304.plt
		//  with the same length, and with the date format has the most
		//  significant time (year) first and least significant time (seconds)
		//  last, lexicographical ordering preserves temporal ordering.
		Collections.sort(files);
		
		// Create a set of Files for each of these files.
		pltFiles = new LinkedList<GeoLifeFile>();
		for (String f: files) {
			pltFiles.add(new GeoLifeFile(dataFilesDirectory.resolve(f).toUri()));
		}
	}<commit_msg>verifying files are sorted in order of time<commit_after>

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.nio.file.Path;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class GeoLifeUser  extends GeoLifeEntity {
	private String userID;
	List<GeoLifeFile> pltFiles;
	private Scanner plt_scanner;
	
	public GeoLifeUser(Path root, String userID) throws FileNotFoundException, ParseException {
		this.userID = userID;
		initPltFiles(root);

		minX = minY = Double.MAX_VALUE;	// All values are smaller than Double.MAX_VALUE.
		maxX = maxY = Double.MIN_VALUE; // All values are bigger than Double.MIN_VALUE.
		minTime = Integer.MAX_VALUE;
		maxTime = Integer.MIN_VALUE;	
	}
	
	private void initPltFiles(Path root) {
		// Create a path representing where the individual PLT files are located.
		//  It is expected this path will look like:
		//  /some/given/path/Data/<userID>/Trajectory/
		Path dataFilesDirectory = root.resolve(userID).resolve("Trajectory");
		
		// Find all plt filenames inside this directory.
		String[] pltFilenames = dataFilesDirectory.toFile().list(new FilenameFilter() {
          @Override
          public boolean accept(File dir, String name) {
            return name.endsWith("plt");
          }
        });
		
		System.out.printf("%d files found for user %s\n", pltFilenames.length, userID);
		List<String> files = Arrays.asList(pltFilenames);
		// Sort files such that the first file is the earliest one created.
		//  The sorting below is accomplished through lexicographical sorting
		//  based on the file paths. Since file names are in the format
		//		20081023025304.plt
		//  with the same length, and with the date format has the most
		//  significant time (year) first and least significant time (seconds)
		//  last, lexicographical ordering preserves temporal ordering.
		Collections.sort(files);
		
		// Create a set of Files for each of these files.
		pltFiles = new LinkedList<GeoLifeFile>();
		for (String f: files) {
			pltFiles.add(new GeoLifeFile(dataFilesDirectory.resolve(f).toUri()));
		}
		
		// Assert the files are in ascending order.
		long previous = Long.MIN_VALUE;
		long current;
		String current_filename;
		for (GeoLifeFile f: pltFiles) {
			current_filename = f.getName();
			current = Long.parseLong(current_filename.substring(0, current_filename.indexOf("."))); 
			System.out.printf("%d compared to %d\n", previous, current);
			
			assert previous <= current: "Previous file did not occur before current file";
			previous = current;
		}
	}
{'fraction_non_alphanumeric': 0.09626436781609195, 'fraction_numerical': 0.005952380952380952, 'mean_word_length': 3.717328170377541, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6498748', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1435, 'n_words': 459}