Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » How to specify integer value in an invariant?
How to specify integer value in an invariant? [message #1058337] Mon, 13 May 2013 15:23 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi,

Lets take this example:

Constraint invariant = helper.createInvariant("self.Modules->size()<=20")

How to give 20 as integer?

In here, it takes as string, and i get an error:
Exception in thread "main" java.lang.AbstractMethodError: org.eclipse.ocl.ecore.impl.IntegerLiteralExpImpl.setLongSymbol(Ljava/lang/Long;)V

Thanks
Re: How to specify integer value in an invariant? [message #1059414 is a reply to message #1058337] Sat, 18 May 2013 05:57 Go to previous messageGo to next message
Abbas Mansoori Razi is currently offline Abbas Mansoori RaziFriend
Messages: 7
Registered: August 2012
Junior Member
hi
you must use AbstractVisitor in order walking ocl AST
and override visitOperationCallExp method,and useing getIntegerSymbol() such as follow:
List<OCLExpression<EClassifier>> arguments = callExp.getArgument();


if (arguments.isEmpty()) {
argumentResults = Collections.emptyList();
} else {
argumentResults = new java.util.ArrayList<Boolean>(arguments.size());
System.out.printf( arguments.toString());

for (OCLExpression<EClassifier> qual : arguments) {
if(qual instanceof IntegerLiteralExp)
{
valProperty=((IntegerLiteralExp) qual).getIntegerSymbol();
}
argumentResults.add(safeVisit(qual));

}
}
Regards
Abbas Mansoori Razi
Re: How to specify integer value in an invariant? [message #1059436 is a reply to message #1059414] Sat, 18 May 2013 11:40 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7658
Registered: July 2009
Senior Member
Hi

The original question made no sense to me, so perhaps I'm not surprised
that the answer doesn't either.

Regards

Ed Willink

On 18/05/2013 06:57, Abbas Mansoori Razi wrote:
> hi
> you must use AbstractVisitor in order walking ocl AST
> and override visitOperationCallExp method,and useing
> getIntegerSymbol() such as follow:
> List<OCLExpression<EClassifier>> arguments = callExp.getArgument();
> if (arguments.isEmpty()) {
> argumentResults = Collections.emptyList();
> } else {
> argumentResults = new
> java.util.ArrayList<Boolean>(arguments.size());
> System.out.printf( arguments.toString());
> for (OCLExpression<EClassifier>
> qual : arguments) {
> if(qual instanceof IntegerLiteralExp)
> {
> valProperty=((IntegerLiteralExp)
> qual).getIntegerSymbol();
> }
> argumentResults.add(safeVisit(qual));
> }
> }
> Regards
> Abbas Mansoori Razi
Previous Topic:line1 : error missing EOF at '('
Next Topic:Custom validation failure messages
Goto Forum:
  


Current Time: Tue May 14 04:38:12 GMT 2024

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

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

Back to the top