Commit c36f2b47 authored by Leonard Faecke's avatar Leonard Faecke
Browse files

+ Added basic analysis of template definitions

* Changed TODOs in other basic function calls to simple counting
parent 0047de31
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -44,18 +44,6 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
		//System.out.println("Module, FunctionDef, AltConstruct, RecordDefNamed, ComponentDef, ConstDef");
		for (TTCN3Module module : ((TTCN3File)model).getModules()) {
			//immediate output (will look weird if single-core is not activated)
			//TODO: count different constructs (naive approach), e.g.
			/*
			System.out.println(module.getName() 
					+ ", " +EcoreUtil2.getAllContentsOfType(module, FunctionDef.class).size()
					+ ", " +EcoreUtil2.getAllContentsOfType(module, AltConstruct.class).size()
					+ ", " +EcoreUtil2.getAllContentsOfType(module, RecordDefNamed.class).size()
					+ ", " +EcoreUtil2.getAllContentsOfType(module, ComponentDef.class).size()
					+ ", " +EcoreUtil2.getAllContentsOfType(module, ConstDef.class).size()
					);
			
			*/
			//TODO: very inefficient, better to traverse tree once, e.g.
			
			//process with a stream
			
@@ -385,6 +373,7 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeGroupDef(GroupDef group, TTCN3Usage output) {
		System.out.println("Analyzing group");
		String id = "Group";
		if(group.getList() != null) {
			id += "Size" + group.getList().getDefinitions().size();
@@ -396,12 +385,18 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	}
	
	/**
	 * Analyzes a template definition. Currently just a skeleton
	 * Analyzes a template definition on its base type and whether it is derived
	 * @param tem The template definition to be analyzed
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeTemplateDef(TemplateDef tem, TTCN3Usage output) {
		System.out.println("TODO");
		System.out.println("Analyzing template");
		if(tem.getBase().getType().getPre() != null) {
			addToOutput(output, "Template:" + tem.getBase().getType().getPre());
		} else addToOutput(output, "Template:Non-Primitive");
		if(tem.getDerived() != null) addToOutput(output, "Template:Derived");
		//TODO analyze body
		//TODO analyze Restriction
	}
	
	/**
@@ -410,7 +405,8 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeTestcaseDef(TestcaseDef test, TTCN3Usage output) {
		System.out.println("TODO");
		addToOutput(output, "Testcase");
		//TODO everything
	}
	
	/**
@@ -419,7 +415,8 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeSignatureDef(SignatureDef sig, TTCN3Usage output) {
		System.out.println("TODO");
		addToOutput(output, "Signature");
		//TODO everything
	}
	
	/**
@@ -485,7 +482,8 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeAltstepDef(AltstepDef alt, TTCN3Usage output) {
		System.out.println("TODO");
		addToOutput(output, "Altstep");
		//TODO everything
	}
	
	/**
@@ -494,7 +492,8 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeExtConstDef(ExtConstDef con, TTCN3Usage output) {
		System.out.println("TODO");
		addToOutput(output, "ExtConst");
		//TODO everything
	}
	
	/**
@@ -503,7 +502,8 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeExtFunctionDef(ExtFunctionDef fun, TTCN3Usage output) {
		System.out.println("TODO");
		addToOutput(output, "ExtFunction");
		//TODO everything
	}
	
	/**
@@ -512,7 +512,8 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeModuleParDef(ModuleParDef mod, TTCN3Usage output) {
		System.out.println("TODO");
		addToOutput(output, "ModulePar");
		//TODO everything
	}
	
	@Override