Skip to main content



      Home
Home » Modeling » Epsilon » Using negative roles on EPL(EPL)
Using negative roles on EPL [message #1786473] Thu, 03 May 2018 17:03 Go to next message
Eclipse UserFriend
Hi, I'm a research student learning EPL and new to this forum. I'm trying to use EPL to find classes which don't have a stter or a getter, but I'm running with a problem when adding the negative role as explained on the Epsilon Book.

Internal error: java.lang.RuntimeException: Undefined variable, type or model: 'setter'
	at [...gettersAndSetter.epl@12:9-12:15]


This only happends when adding the "no" keyword. Can someone help me on how to use negative roles correctly since they are barely touched on the book.
Here is the EPL program

pre {
	var methodMap = MethodDeclaration.all.mapBy(m|m.name);
}
pattern PublicField
	package: Package
		guard: package.getName() = "entities", 
	class: ClassDeclaration,
	field: FieldDeclaration
		from: class.bodyDeclarations,
	no setter: MethodDeclaration
		from: getMethods("set" + field.getName())
		guard: setter.abstractTypeDeclaration = class
		optional: true,
	no getter: MethodDeclaration
		from: getMethods("get" + field.getName()).includingAll(getMethods("is" + field.getName()))
		guard: getter.abstractTypeDeclaration = class
		optional: setter.isDefined() {
	onmatch {
 		var message : String;
 		message = field.getName() + " matches";
		message.println();
		
	}
}

operation getMethods(name : String) : Sequence(MethodDeclaration) {
	var methods = methodMap.get(name);
	if (methods.isDefined()) return methods;
		else return new Sequence;
}

@cached
operation FieldDeclaration getName() {
	return self.fragments.at(0).name.firstToUpperCase();
}


Thanks so much.
Re: Using negative roles on EPL [message #1786552 is a reply to message #1786473] Mon, 07 May 2018 04:03 Go to previous message
Eclipse UserFriend
Hi Camilo,

"no setter" means that subsequent roles of the pattern (i.e. "no getter") will only be evaluated if no MethodDeclaration meets the setter's "guard" condition. As such, unlike with regular/positive roles, negative roles do not create variables that subsequent roles can refer to.

Cheers,
Dimitris
Previous Topic:Evl validation without GUI
Next Topic:EGL and CSV
Goto Forum:
  


Current Time: Tue Oct 28 17:03:21 EDT 2025

Powered by FUDForum. Page generated in 0.04052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top