Problems with a loop [message #1817472] |
Fri, 22 November 2019 15:57  |
Eclipse User |
|
|
|
Hi folks , i,m trying to do a loop that collect me objects that meet a property , this looks me several days , and i can,t to find the mistake , maybe somebody can to help me , thanks , this is the code :
tick()
begin
for p in (self.paquetes -> collect( p | p.tiempoRestante = 0)) do
declare ns : Servidor , nt : Transmisor ;
if (self.servidor -> notEmpty()) then
ns := self.servidor -> sortedBy(n | n.paquetes -> size()) -> any(true) ;
self.transmitirS(p , ns) ;
else
nt := self.nodo2 -> sortedBy(n | n.paquetes -> size()) -> any(true) ;
delete (self,p) from Procesando ;
insert (nt,p) into Procesando ;
nt.recibirT(p,self);
end
end
end
At compile time it says to me that p , in self.transmitirS(p,ns) , is a boolean and not an object , it have to be an object of self.paquetes , why is a boolean ??? . thanks
|
|
|
Re: Problems with a loop [message #1817479 is a reply to message #1817472] |
Sat, 23 November 2019 03:09  |
Eclipse User |
|
|
|
Hi
While there are some sub-expressions in your example that are probably OCL, the example as whole is clearly not OCL. OCL has no begin/for/do/end/insert/delete/:=/boolean/declare/into/from.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.03736 seconds