Commit 98c8b3c9 authored by Leonard Faecke's avatar Leonard Faecke
Browse files

+ Added analysis for signature definitions

parent 28001372
Loading
Loading
Loading
Loading
+44 −5
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
				} else {
					if(p.getValue().getType().getPre() == null) {
						id += "Non-Primitive";
						addToOutput(output, id + ":" + p.getValue().getType().getRef().getHead());
						//addToOutput(output, id + ":" + p.getValue().getType().getRef().getHead());
					} else {
						id += p.getValue().getType().getPre();
					}
@@ -410,13 +410,52 @@ public class UsageAnalyzer implements Callable<TTCN3Usage> {
	}
	
	/**
	 * Analyzes a signature definition. Currently just a skeleton
	 * Analyzes a signature definition.
	 * @param sig The signature definition to be analyzed
	 * @param output The TTCN3Usage to write the output to
	 */
	private void analyzeSignatureDef(SignatureDef sig, TTCN3Usage output) {
		addToOutput(output, "Signature");
		//TODO everything
		
		//return values
		String id = "SignatureReturn:";
		if(sig.getReturn() == null) {
			id += "void";
		} else if(sig.getReturn().getType().getPre() == null) {
			id += "Non-Primitive";
		} else {
			id += sig.getReturn().getType().getPre();
		}
		addToOutput(output, id);
		
		
		//parameters
		if(sig.getParamList() != null) {
			for(FormalValuePar par : sig.getParamList().getParams()) {
				id = "SignatureParam:";
				if(par.getType().getPre() != null) {
					id += par.getType().getPre();
				} else {
					id += "Non-Primitive";
				}
				addToOutput(output, id);
			}
			id = sig.getParamList().getParams().size() + "SignatureParams";
		} else {
			id = "0SignatureParams";
		}
		addToOutput(output, id);
		
		//Exceptions
		if(sig.getSprec() != null) {
			//Q: only example in resources -> different classes possible?
			if(sig.getSprec().getClass() == TypeListImpl.class) {
				for(Type t : ((TypeListImpl) sig.getSprec()).getTypes()) {
					if(t.getPre() == null) addToOutput(output, "SignatureExcept:Non-Primitive");
					else addToOutput(output, "SignatureExcept:" + t.getPre());
				}
				addToOutput(output, ((TypeListImpl) sig.getSprec()).getTypes().size() + "SignatureExceptions");
			}
		} else addToOutput(output, "0SignatureExceptions");
	}
	
	/**
@@ -531,7 +570,7 @@ System.out.println("Analyzing function");
				} else {
					if(p.getValue().getType().getPre() == null) {
						id += "Non-Primitive";
						addToOutput(output, id + ":" + p.getValue().getType().getRef().getHead());
						//addToOutput(output, id + ":" + p.getValue().getType().getRef().getHead());
					} else {
						id += p.getValue().getType().getPre();
					}