<commit_before>package verification;

import java.io.File;
import java.util.ArrayList;
import verification.platu.main.Options;
import verification.platu.project.Project;

import lpn.parser.LhpnFile;



/**
 * This class provides script to run depth-first search and partial order reduction (in the platu package)
 * without the need for a GUI.
 * @author <NAME>
 *
 */

public class VerificationNoGui {
	
	public static void main (String[] args) {
		if (args.length == 0) {
			System.err.println("Error: Missing arguments.");
			System.exit(0);
		}
		//System.out.println("Enter the directory of all LPNs: ");
		//Scanner scanner = new Scanner(System.in);
		//String directory = scanner.nextLine();
		String directory = null; 
		boolean poroff = true;
		for (int i=0; i<args.length; i++) {
			if (args[i].equals("-portb")) {
				Options.setPOR("tb");
				Options.setCycleClosingMthd("behavioral");
				Options.setCycleClosingAmpleMethd("cctb");
				poroff = false;
			}
			else if (args[i].equals("-porbehavioral")) {
				Options.setPOR("behavioral");
				Options.setCycleClosingMthd("behavioral");
				Options.setCycleClosingAmpleMethd("cctboff");
				poroff = false;
			}
			else if (args[i].equals("-portboff")) {
				Options.setPOR("tboff");
				Options.setCycleClosingMthd("behavioral");
				Options.setCycleClosingAmpleMethd("cctboff");
				poroff = false;
			}
			else if (args[i].contains("-dir=")) { // Directory should be provided as an argument starting with -dir:
				directory = args[i].trim().substring(5);
			}
			else if (args[i].contains("-log=")) { // Runtime, memory usage, and state count etc are written in the log file specified here.
				Options.setLogName(args[i].trim().substring(5));
			}
			else if (args[i].contains("-memlim=")) {
				Options.setMemUpperBoundFlag();
				String memUpperBound = args[i].trim().replace("-memlim=", "");
				if(memUpperBound.contains("G")) {
					memUpperBound = memUpperBound.replace("G", "");					
					Options.setMemoryUpperBound((long)(Float.parseFloat(memUpperBound) * 1000000000));
				}
				if(memUpperBound.contains("M")) {
					memUpperBound = memUpperBound.replace("M", "");
					Options.setMemoryUpperBound((long)(Float.parseFloat(memUpperBound) * 1000000));
				}
			}
			else if (args[i].contains("-disableDeadlockPreserve")) {
				Options.disablePORdeadlockPreserve();
			}
			else if (args[i].contains("-debugON")) {
				Options.setDebugMode(true);
				System.out.println("Debug mode is ON.");
			}
			else if (args[i].contains("-depQueue")) {
				Options.setUseDependentQueue();
				System.out.println("Use dependent queue.");
			}
			else if (args[i].contains("-disableDisablingError")) {
				Options.disableDisablingError();
				System.out.println("Disabling error was diabled.");
			}
			else if (args[i].contains("-generateStateGraph")) {
				Options.setOutputSgFlag(true);
				System.out.println("Gererate state graphs.");
			}
			
		}
		if (directory.trim().equals("") || directory == null) {
			System.out.println("Direcotry provided is empty. Exit.");
			System.exit(0);
		}
		File dir = new File(directory);
		if (!dir.exists()) {
			System.err.println("Invalid direcotry. Exit.");
			System.exit(0);
		}
		Options.setPrjSgPath(directory);
		// Options for printing the final numbers from search_dfs or search_dfsPOR. 
		Options.setOutputLogFlag(true);
		//Options.setDebugMode(false);
				
		File[] lpns = dir.listFiles(new FileExtentionFilter(".lpn"));
		ArrayList<LhpnFile> lpnList = new ArrayList<LhpnFile>();
		for (int i=0; i < lpns.length; i++) {
		 String curLPNname = lpns[i].getName();
		 LhpnFile curLPN = new LhpnFile();
		 curLPN.load(directory + curLPNname);
		 lpnList.add(curLPN);
		}		
		System.out.println("====== LPN loading order ========");
		for (int i=0; i<lpnList.size(); i++) {
			System.out.println(lpnList.get(i).getLabel());<commit_msg>Added a new flag -prob for the command line to indicate stochastic LPN(s).<commit_after>package verification;

import java.io.File;
import java.util.ArrayList;
import verification.platu.main.Options;
import verification.platu.project.Project;

import lpn.parser.LhpnFile;



/**
 * This class provides script to run depth-first search and partial order reduction (in the platu package)
 * without the need for a GUI.
 * @author <NAME>
 *
 */

public class VerificationNoGui {
	
	public static void main (String[] args) {
		if (args.length == 0) {
			System.err.println("Error: Missing arguments.");
			System.exit(0);
		}
		//System.out.println("Enter the directory of all LPNs: ");
		//Scanner scanner = new Scanner(System.in);
		//String directory = scanner.nextLine();
		String directory = null; 
		boolean poroff = true;
		for (int i=0; i<args.length; i++) {
			if (args[i].equals("-portb")) {
				Options.setPOR("tb");
				Options.setCycleClosingMthd("behavioral");
				Options.setCycleClosingAmpleMethd("cctb");
				poroff = false;
			}
			else if (args[i].equals("-porbehavioral")) {
				Options.setPOR("behavioral");
				Options.setCycleClosingMthd("behavioral");
				Options.setCycleClosingAmpleMethd("cctboff");
				poroff = false;
			}
			else if (args[i].equals("-portboff")) {
				Options.setPOR("tboff");
				Options.setCycleClosingMthd("behavioral");
				Options.setCycleClosingAmpleMethd("cctboff");
				poroff = false;
			}
			else if (args[i].contains("-dir=")) { // Directory should be provided as an argument starting with -dir:
				directory = args[i].trim().substring(5);
			}
			else if (args[i].contains("-log=")) { // Runtime, memory usage, and state count etc are written in the log file specified here.
				Options.setLogName(args[i].trim().substring(5));
			}
			else if (args[i].contains("-memlim=")) {
				Options.setMemUpperBoundFlag();
				String memUpperBound = args[i].trim().replace("-memlim=", "");
				if(memUpperBound.contains("G")) {
					memUpperBound = memUpperBound.replace("G", "");					
					Options.setMemoryUpperBound((long)(Float.parseFloat(memUpperBound) * 1000000000));
				}
				if(memUpperBound.contains("M")) {
					memUpperBound = memUpperBound.replace("M", "");
					Options.setMemoryUpperBound((long)(Float.parseFloat(memUpperBound) * 1000000));
				}
			}
			else if (args[i].contains("-disableDeadlockPreserve")) {
				Options.disablePORdeadlockPreserve();
			}
			else if (args[i].contains("-debugON")) {
				Options.setDebugMode(true);
				System.out.println("Debug mode is ON.");
			}
			else if (args[i].contains("-depQueue")) {
				Options.setUseDependentQueue();
				System.out.println("Use dependent queue.");
			}
			else if (args[i].contains("-disableDisablingError")) {
				Options.disableDisablingError();
				System.out.println("Disabling error was diabled.");
			}
			else if (args[i].contains("-generateStateGraph")) {
				Options.setOutputSgFlag(true);
				System.out.println("Gererate state graphs.");
			}
			else if (args[i].contains("-prob")) {
				Options.setProbabilisticLPNflag();
				System.out.println("Probabilistic LPNs.");
			}
			
		}
		if (directory.trim().equals("") || directory == null) {
			System.out.println("Direcotry provided is empty. Exit.");
			System.exit(0);
		}
		File dir = new File(directory);
		if (!dir.exists()) {
			System.err.println("Invalid direcotry. Exit.");
			System.exit(0);
		}
		Options.setPrjSgPath(directory);
		// Options for printing the final numbers from search_dfs or search_dfsPOR. 
		Options.setOutputLogFlag(true);
		//Options.setDebugMode(false);
				
		File[] lpns = dir.listFiles(new FileExtentionFilter(".lpn"));
		ArrayList<LhpnFile> lpnList = new ArrayList<LhpnFile>();
		for (int i=0; i < lpns.length; i++) {
		 String curLPNname = lpns[i].getName();
		 LhpnFile curLPN = new LhpnFile();
		 curLPN.load(directory + curLPNname);
		 lpnList.add(curLPN);
		}		
		System.out.println("====== LPN loading order ========");
		for (int i=0; i<lpnList.size(); i++) {
			System.out.println(lpnList.get(i).getLabel());
{'fraction_non_alphanumeric': 0.16305312539622163, 'fraction_numerical': 0.006593127932040066, 'mean_word_length': 3.933083176985616, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '1778133', 'n_tokens_mistral': 3062, 'n_tokens_neox': 2578, 'n_words': 519}