Adding new operation in OCL standard library [message #1085865] |
Tue, 13 August 2013 13:30 |
ModelGeek Mising name Messages: 550 Registered: June 2011 |
Senior Member |
|
|
i want to add an operation in standard ocl library. The signature of operation is like
real operation(real, real)
I am uncertain about categorizing this operation. This is neither a collection operation nor operation for numeric types(x.floor(), x.abs(), etc)
i want to use it like
let x : Real = operation(20, 2)
Can you please guide me under which category i should define this operation? Should i define it under OclAny category?
Regards,
[Updated on: Tue, 13 August 2013 13:39] Report message to a moderator
|
|
|
|
Re: Adding new operation in OCL standard library [message #1086511 is a reply to message #1085884] |
Wed, 14 August 2013 09:36 |
ModelGeek Mising name Messages: 550 Registered: June 2011 |
Senior Member |
|
|
I meant context by category
like
real.abs() has Real as context and collection opertions have Collection context.
I do not want to have context like real.abs()
i want to use following OCL "let x : Real = myoperation(100,2) in x"
where i have defined operation in standard library under
type OclAny : AnyType {
annotation 'http://www.omg.org/ocl'(ClassGroup='OCL');
operation myoperation(a: Real, b: Real) : Real => 'path to implementation class';
.......
......
}
but i am getting following exceptions...
org.eclipse.ocl.examples.pivot.SemanticException: Errors in 'let x : Real = myoperation(100,2) in x'
1: Unresolved Operation '::myoperation(UnlimitedNatural, UnlimitedNatural)'
at org.eclipse.ocl.examples.pivot.utilities.PivotUtil.checkResourceErrors(PivotUtil.java:171)
at org.eclipse.ocl.examples.pivot.context.AbstractParserContext.parse(AbstractParserContext.java:120)
at org.eclipse.ocl.examples.pivot.helper.OCLHelperImpl.createQuery(OCLHelperImpl.java:124)
at oclextplugin.ext.OCLStdLibTest.<init>(OCLStdLibTest.java:85)
at oclextplugin.View.createPartControl(View.java:71)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:142)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityView.createPartControl(CompatibilityView.java:174)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:323)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
Do you have any idea why is that?
[Updated on: Wed, 14 August 2013 09:38] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: Adding new operation in OCL standard library [message #1087199 is a reply to message #1087182] |
Thu, 15 August 2013 09:16 |
ModelGeek Mising name Messages: 550 Registered: June 2011 |
Senior Member |
|
|
Yes i can understand.
i would like to ask one simple question then
i have defined myoperation under OCLAny
"let x : Real = myoperation(100,2) in x" does not work and gives exception
but "let x : Real = 10 in x.myoperation(100,2)" works perfecly
and also "let x : Real = OclAny.myoperation(100,2) in x" works perfectly
do you have any clue why first ocl statement myoperation is not recognized?
thanks for your help!
regards,
[Updated on: Thu, 15 August 2013 09:29] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.07358 seconds