package javamop.parser.ast.visitor;

import javamop.parser.ast.mopspec.EventDefinition;

/**
 * @author Qingzhou Luo
 */

public class RVDumpVisitor extends DumpVisitor {
	
	@Override
	public void visit(EventDefinition e, Object arg) {
		if (e.isCreationEvent()) {
			printer.print("creation ");
		}
		//printer.print("event " + e.getUniqueId());
		printer.print("event " + e.getId());
		printSpecParameters(e.getParameters(), arg);
		if (e.getCondition() != null && e.getCondition().length() > 0) {
			printer.print("{\n");
			printer.print("if ( ! (" + e.getCondition() + ") ) {\n");
			printer.print("return;\n");
			printer.print("}\n");
		}
		
		if (e.getAction() != null) {
			e.getAction().accept(this, arg);
		}
		printer.printLn();
		if (e.getCondition() != null && e.getCondition().length() > 0) {
			printer.print("}\n");
		}
	}
}

@@ -80,16 +80,113 @@
 inition;
+%0Aimport javamop.parser.ast.mopspec.MOPParameter;%0Aimport javamop.parser.ast.mopspec.MOPParameters;
 %0A%0A/**%0A *
@@ -396,10 +396,8 @@
 %7D%0A%09%09
-//
 prin
@@ -426,14 +426,8 @@
 .get
-Unique
 Id()
@@ -435,45 +435,207 @@
 ;%0A%09%09
-printer.print(%22event %22 + e.getId
+MOPParameters parameters = e.getParameters();%0A%09%09if (e.hasReturning()) %7B%0A%09%09%09parameters.addAll(e.getRetVal().toList());%0A%09%09%7D%0A%09%09if (e.hasThrowing()) %7B%0A%09%09%09parameters.addAll(e.getThrowVal().toList
 ());%0A
+%09%09%7D%0A
 %09%09pr
@@ -652,22 +652,17 @@
 ameters(
-e.getP
+p
 arameter
@@ -662,18 +662,16 @@
 rameters
-()
 , arg);%0A

add returning and throwing pointcut q