leaf-analysis/src/simulation/Main.java
/**
	 * This method is responsible to execute all steps to generate the analysis file.
	 * @param args Default command line arguments.
	 */
This method is responsible to execute all steps to generate the analysis file.
@param args Default command line arguments.
This method is responsible to execute all steps to generate the analysis file . @param args Default command line arguments .
public static void main(String[] args) {
		String filePath = "temp/"; 			
		String inputFile = "default.json";
		String outputFile = "output.out";
		try {
			ModelSpec modelSpec = convertBackboneModelFromFile(filePath + inputFile);
	    	switch (modelSpec.getAnalysisType()) {	
	    	case "singlePath":
	    	case "updatePath":
	    		BICSPPath solver = new BICSPPath(modelSpec);
				IOSolution outputModel = solver.solveModel();
				createOutputFile(outputModel, filePath + outputFile);	
	    		break;
	    	case "allNextStates":
	    		IOSolution outputModelNext = BICSPState.solveModel(modelSpec);
				createOutputFile(outputModelNext, filePath + outputFile);	
	    		break;    		
	    	default:
	    		throw new Exception("User Error: User requested \'" + modelSpec.getAnalysisType() + "\', no such scenario exists. ");
	    	}
		} catch (RuntimeException e) {
			try {
				if (DEBUG) System.err.println(e.getMessage());	
				File file;
				file = new File(filePath + outputFile);
				if (!file.exists()) {
					file.createNewFile();
				}
				PrintWriter printFile = new PrintWriter(file);
				String message = "{ \"errorMessage\" : \"RuntimeException: " + e.getMessage() + "\" }";
				message = message.replaceAll("\\r\\n|\\r|\\n", " ");
				printFile.printf(message);
				printFile.close();
			} catch (Exception f) {
				throw new RuntimeException("Error while writing ErrorMessage: " + f.getMessage());
			}
		} catch (Exception e) {
			try {
				if (DEBUG) System.err.println(e.getMessage());	
				File file;
				file = new File(filePath + outputFile);
				if (!file.exists()) {
					file.createNewFile();
				}
				PrintWriter printFile = new PrintWriter(file);
				String message = "{ \"errorMessage\" : \"Exception: " + e.getMessage() + "\" }";
				message = message.replaceAll("\\r\\n|\\r|\\n", " ");
				printFile.printf(message);
				printFile.close();
			} catch (Exception f) {
				throw new RuntimeException("Error while writing ErrorMessage: " + f.getMessage());
			}
		} 
	}
public static void main ( String [ ] args ) { String filePath = "temp/" ; String inputFile = "default.json" ; String outputFile = "output.out" ; try { ModelSpec modelSpec = convertBackboneModelFromFile ( filePath + inputFile ) ; switch ( modelSpec . getAnalysisType ( ) ) { case "singlePath" : case "updatePath" : BICSPPath solver = new BICSPPath ( modelSpec ) ; IOSolution outputModel = solver . solveModel ( ) ; createOutputFile ( outputModel , filePath + outputFile ) ; break ; case "allNextStates" : IOSolution outputModelNext = BICSPState . solveModel ( modelSpec ) ; createOutputFile ( outputModelNext , filePath + outputFile ) ; break ; default : throw new Exception ( "User Error: User requested \'" + modelSpec . getAnalysisType ( ) + "\', no such scenario exists. " ) ; } } catch ( RuntimeException e ) { try { if ( DEBUG ) System . err . println ( e . getMessage ( ) ) ; File file ; file = new File ( filePath + outputFile ) ; if ( ! file . exists ( ) ) { file . createNewFile ( ) ; } PrintWriter printFile = new PrintWriter ( file ) ; String message = "{ \"errorMessage\" : \"RuntimeException: " + e . getMessage ( ) + "\" }" ; message = message . replaceAll ( "\\r\\n|\\r|\\n" , " " ) ; printFile . printf ( message ) ; printFile . close ( ) ; } catch ( Exception f ) { throw new RuntimeException ( "Error while writing ErrorMessage: " + f . getMessage ( ) ) ; } } catch ( Exception e ) { try { if ( DEBUG ) System . err . println ( e . getMessage ( ) ) ; File file ; file = new File ( filePath + outputFile ) ; if ( ! file . exists ( ) ) { file . createNewFile ( ) ; } PrintWriter printFile = new PrintWriter ( file ) ; String message = "{ \"errorMessage\" : \"Exception: " + e . getMessage ( ) + "\" }" ; message = message . replaceAll ( "\\r\\n|\\r|\\n" , " " ) ; printFile . printf ( message ) ; printFile . close ( ) ; } catch ( Exception f ) { throw new RuntimeException ( "Error while writing ErrorMessage: " + f . getMessage ( ) ) ; } } }
This method is responsible to execute all steps to generate the analysis file.
This method is responsible to execute all steps to generate the analysis file .
//This is the default filePath to be executed if no file is pass through parameters // Creating the back-end model to be analyzed // Creates the store and constraint problem to be solved. //long startTime = System.currentTimeMillis();                            //Scaleability Testing //long endTime = System.currentTimeMillis();                              //Scalability Testing //System.out.print("Time:" + (endTime - startTime));					  //Scalability Testing //				BICSPAlgorithm solverNext = new BICSPAlgorithm(modelSpec);	 //				IOSolution outputModelNext = solverNext.solveModel();