Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using negative roles on EPL(EPL)
Using negative roles on EPL [message #1786473] Thu, 03 May 2018 21:03 Go to next message
Camilo Mendoza is currently offline Camilo MendozaFriend
Messages: 5
Registered: May 2018
Junior Member
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 08:03 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1608
Registered: July 2009
Location: York, UK
Senior Member

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 Nov 13 21:05:37 GMT 2018

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

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

Back to the top