当前位置: 首页>>代码示例>>Java>>正文


Java JavaStringCompiler.getCompilerResult方法代码示例

本文整理汇总了Java中vk.core.api.JavaStringCompiler.getCompilerResult方法的典型用法代码示例。如果您正苦于以下问题:Java JavaStringCompiler.getCompilerResult方法的具体用法?Java JavaStringCompiler.getCompilerResult怎么用?Java JavaStringCompiler.getCompilerResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vk.core.api.JavaStringCompiler的用法示例。


在下文中一共展示了JavaStringCompiler.getCompilerResult方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTestResults

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
 * Method: setTestResults
 * <p>
 * Task: Method that saves the errors/information from the internal compiler
 * into an ArrayList.
 *
 * @param compiler
 *            so that method can access the information
 *
 * @return void
 */

protected void setTestResults(JavaStringCompiler compiler) {
    CompilerResult compilerResult = compiler.getCompilerResult();
    testResults = new LinkedList<>();
    if (!compilerResult.hasCompileErrors()) {
        int failedTestsNumber = compiler.getTestResult().getNumberOfFailedTests();
        failedTests = Integer.toString(failedTestsNumber);
        int ignoredTestsNumber = compiler.getTestResult().getNumberOfIgnoredTests();
        ignoredTests = Integer.toString(ignoredTestsNumber);
        int successfulTestsNumber = compiler.getTestResult().getNumberOfSuccessfulTests();
        successfulTests = Integer.toString(successfulTestsNumber);

        testResults.add(successfulTests);
        testResults.add(ignoredTests);
        testResults.add(failedTests);

    } else {
        testResults.add("");
        testResults.add("");
        testResults.add("");
    }
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-zenamike,代码行数:34,代码来源:CompileResults.java

示例2: acceptanceCheck

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
public String acceptanceCheck() {
	acceptance = false;
	CompilationUnit classToTest = new CompilationUnit(myClass, myCode, false);
	CompilationUnit aTest = new CompilationUnit(acceptanceTestName, acceptanceTest, true);
	JavaStringCompiler myCompileObject = CompilerFactory.getCompiler(classToTest, aTest);
	myCompileObject.compileAndRunTests();
	CompilerResult cpResult = myCompileObject.getCompilerResult();
	
	String result = "";
	
	if(cpResult.hasCompileErrors()) {
		result = handleErrors(cpResult, aTest);
	}
	else if(testCode.contains("@Test")) {
		result = handleAcceptanceTests(myCompileObject);
		if(testSuccess && acceptance) acceptance = true;
		else acceptance = false;
	}
	else result = "Please add a proper Acceptance Test!";
	
	return result;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:23,代码来源:CompileHandler.java

示例3: compileCode

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
 * Compiles the passed code and sets info to compile errors if there are any.
 * @param code The code that is going to be compiled
 * @param className The classname of the code
    * @return True if the code is compilable. Otherwise false.
    */
public boolean compileCode(String code, String className) {
	//String className       = findClassName(code).trim();
	CompilationUnit cu     = new CompilationUnit(className, code, false);
	JavaStringCompiler jsc = CompilerFactory.getCompiler(cu);

	jsc.compileAndRunTests();
	CompilerResult cr = jsc.getCompilerResult();

	if (cr.hasCompileErrors()) {
		info = formatCompileErrors(cr, cu);
		return false;
	}

	return true;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:22,代码来源:TDDTCompiler.java

示例4: compileAndRunTests

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
 * Compiles and runs the passed test and sets info to any error that may have occured.
 * @param code Code of code to be compiled
 * @param codeClassName Classname of the code
 * @param test Code of tests to be compiled
 * @param testClassName Classname of the test
 * @return True if the test is compile- and runnable. Otherwise false.
 */
public boolean compileAndRunTests(String code, String codeClassName, String test, String testClassName) {
	CompilationUnit cuCode = new CompilationUnit(codeClassName, code, false);
	CompilationUnit cuTest = new CompilationUnit(testClassName, test, true);
	JavaStringCompiler jsc = CompilerFactory.getCompiler(cuCode, cuTest);
	jsc.compileAndRunTests();
	CompilerResult cr = jsc.getCompilerResult();

	if (cr.hasCompileErrors()) {
		info = formatCompileErrors(cr, cuCode);
		info += formatCompileErrors(cr, cuTest);
		return false;
	}

	TestResult tr = jsc.getTestResult();

	if (tr.getNumberOfFailedTests() != 0) {
		info = formatFailingTests(tr);
		return false;
	}

	return true;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:31,代码来源:TDDTCompiler.java

示例5: CompilerRun

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
public JavaStringCompiler CompilerRun(String className, String classContent, boolean isTest) {
	CompilationUnit unit = new CompilationUnit(className, classContent, isTest);
	JavaStringCompiler compiler = CompilerFactory.getCompiler(unit);
	compiler.compileAndRunTests();
	CompilerResult compilerResult = compiler.getCompilerResult();
	Collection<CompileError> errs = compilerResult.getCompilerErrorsForCompilationUnit(unit);
	for (CompileError e : errs) {
		System.out.println(e.getMessage());
		System.out.println(e.getCodeLineContainingTheError());
	}
	System.out.println("End of errors");
	return compiler;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-two-finger-joe,代码行数:14,代码来源:Logic.java

示例6: executeCompiler

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
public String[] executeCompiler() {
	//führt den Compiler aus. Unterscheidet zwischen Testklasse und Hauptklasse
	testSuccess = false;
	CompilationUnit classToTest = new CompilationUnit(myClass, myCode, false);
	CompilationUnit theTest = new CompilationUnit(testClass, testCode, true);		
	JavaStringCompiler myCompileObject = CompilerFactory.getCompiler(classToTest, theTest);
	myCompileObject.compileAndRunTests();
	CompilerResult cpResult = myCompileObject.getCompilerResult();
	
	String[] results = {"", "", "", ""};
	
	if(cpResult.hasCompileErrors()) {
		results[0] = handleErrors(cpResult, classToTest);
		results[1] = handleErrors(cpResult, theTest);
		
	}
	else if(testCode.contains("@Test")) {
			results[2] = handleTests(myCompileObject);
	}
	else results[2] = "Please add a proper Test!";
	
	String acceptanceResults = "";
	if(acceptanceTest != null) acceptanceResults = acceptanceCheck();
	
	results[3] = acceptanceResults;
	
	return results;
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:29,代码来源:CompileHandler.java

示例7: compile

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
 * Gibt Compilierfehler (wenn vorhanden) auf die (programminterne) Konsole aus
 * 
 * Wandelt übergebene Compilationunits mit {@link #getJSC(CompilationUnit[])} in JavaStringCompiler um,
 * und gibt Compilierfehler mit {@link #print_errors_to_console(Collection)} auf der programminternen Konsole aus.

 */
public static void compile(CompilationUnit[] comp_uns){ //gibt fehlermeldungen, wenn vorhanden auf die console aus
	JavaStringCompiler comp = getJSC(comp_uns);
	CompilerResult comp_res = comp.getCompilerResult();
	if(comp_res.hasCompileErrors()){
		for(CompilationUnit cu: comp_uns){
			Collection<CompileError> errors = comp_res.getCompilerErrorsForCompilationUnit(cu);
			print_errors_to_console(errors);
		}
	} else console.set_textln("No Compilation errors");
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:18,代码来源:Testing.java

示例8: hasCompileErrors

import vk.core.api.JavaStringCompiler; //导入方法依赖的package包/类
/**
 * Prüft ob Compilierfehler vorliegen.
 */
public static boolean hasCompileErrors(CompilationUnit[] comp_uns){ //fuer next-button
	JavaStringCompiler comp = getJSC(comp_uns);
	CompilerResult comp_res = comp.getCompilerResult();
	compile(comp_uns);
	return comp_res.hasCompileErrors();
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:10,代码来源:Testing.java


注:本文中的vk.core.api.JavaStringCompiler.getCompilerResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。