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

+ Added analysis of import statements

parent eccbda23
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -266,25 +266,25 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
			} else if (def.getDef().getClass() == FunctionDefImpl.class) {
				analyzeFunctionDef((FunctionDef) def.getDef(), output);
			} else if(def.getDef().getClass() == ImportDefImpl.class) {
				analyzeImportDef((ImportDef) def, output);
				analyzeImportDef((ImportDef) def.getDef(), output);
			} else if(def.getDef().getClass() == GroupDefImpl.class) {
				analyzeGroupDef((GroupDef) def, output);
				analyzeGroupDef((GroupDef) def.getDef(), output);
			} else if(def.getDef().getClass() == TemplateDefImpl.class) {
				analyzeTemplateDef((TemplateDef) def, output);
				analyzeTemplateDef((TemplateDef) def.getDef(), output);
			} else if(def.getDef().getClass() == TestcaseDefImpl.class) {
				analyzeTestcaseDef((TestcaseDef) def, output);
				analyzeTestcaseDef((TestcaseDef) def.getDef(), output);
			} else if(def.getDef().getClass() == SignatureDefImpl.class) {
				analyzeSignatureDef((SignatureDef) def, output);
				analyzeSignatureDef((SignatureDef) def.getDef(), output);
			} else if(def.getDef().getClass() == TypeDefImpl.class) {
				analyzeTypeDef((TypeDef) def, output);
				analyzeTypeDef((TypeDef) def.getDef(), output);
			} else if(def.getDef().getClass() == AltstepDefImpl.class) {
				analyzeAltstepDef((AltstepDef) def, output);
				analyzeAltstepDef((AltstepDef) def.getDef(), output);
			} else if(def.getDef().getClass() == ExtFunctionDefImpl.class) {
				analyzeExtFunctionDef((ExtFunctionDef) def, output);
				analyzeExtFunctionDef((ExtFunctionDef) def.getDef(), output);
			} else if(def.getDef().getClass() == ExtConstDefImpl.class) {
				analyzeExtConstDef((ExtConstDef) def, output);
				analyzeExtConstDef((ExtConstDef) def.getDef(), output);
			} else if(def.getDef().getClass() == ModuleParDefImpl.class) {
				analyzeModuleParDef((ModuleParDef) def, output);
				analyzeModuleParDef((ModuleParDef) def.getDef(), output);
			} else {
				System.out.println("Unanalyzed: " + def.getDef().getClass());
			}
@@ -358,12 +358,24 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	}
	
	/**
	 * Analyzes the import statements. Currently just a skeleton
	 * Analyzes the import statements.
	 * @param imp The import definition to be analyzed
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeImportDef(ImportDef imp, TTCN3Usage output) {
		System.out.println("TODO");
		String impType = "Import";
		if(imp.getAll() == null && imp.getImportSpec() == null && imp.getSpec() == null) {
			impType += "null"; //Import statement that does not import something, should not happen
		} else if(imp.getImportSpec() != null) { //Q: does anything apart from size matter?
			impType += imp.getImportSpec().getElement().size() + "Specified";
		} else if(imp.getAll() != null) {
			impType += "All";
			if(imp.getAll().getDef() != null) {
				impType += "With" + imp.getAll().getDef().getSpec().getElement().size() + "Except";
			}
		}
		
		addToOutput(output, impType);
	}
	
	/**