@@ -1567,40 +1567,31 @@ end equationNthSize;
15671567public function equationNthSize1
15681568 input list< BackendDAE . Equation > inEqns;
15691569 input Integer pos;
1570- input Integer acc ;
1570+ input Integer inAcc ;
15711571 output BackendDAE . Equation outEquation;
1572+ protected
1573+ Integer acc = inAcc;
1574+ Integer size;
1575+ String str;
15721576algorithm
1573- outEquation := matchcontinue (inEqns, pos, acc)
1574- local
1575- BackendDAE . Equation eqn;
1576- list< BackendDAE . Equation > eqns;
1577- Integer size;
1578- array< Option < BackendDAE . Equation >> arr;
1579- String str;
15801577
1581- case ({}, _, _) equation
1582- str = "BackendEquation.equationNthSize1 failed" ;
1583- print(str + " \n " );
1584- Error . addInternalError(str, sourceInfo()) ;
1585- then fail() ;
1586-
1587- case (eqn::_, _, _) equation
1588- size = equationSize(eqn);
1589- true = (pos >= acc) ;
1590- true = (pos < acc + size) ;
1591- then eqn ;
1578+ for eqn in inEqns loop
1579+ size : = equationSize(eqn) ;
1580+ if (pos >= acc) and (pos < acc + size) then
1581+ outEquation : = eqn ;
1582+ return ;
1583+ elseif (pos >= acc + size) then
1584+ acc : = acc + size;
1585+ else
1586+ break ;
1587+ end if ;
1588+ end for ;
15921589
1593- case (eqn::eqns, _, _) equation
1594- size = equationSize(eqn );
1595- true = (pos >= acc + size );
1596- then equationNthSize1(eqns, pos, acc + size );
1590+ str : = "BackendEquation.equationNthSize1 failed" ;
1591+ print(str + " \n " );
1592+ Error . addInternalError(str, sourceInfo() );
1593+ fail( );
15971594
1598- else equation
1599- str = "BackendEquation.equationNthSize1 failed" ;
1600- print(str + " \n " );
1601- Error . addInternalError(str, sourceInfo());
1602- then fail();
1603- end matchcontinue;
16041595end equationNthSize1;
16051596
16061597public function equationDelete "author: Frenkel TUD 2010-12
0 commit comments