[rules-users] Clarification needed in writing DSL function mapping

Bala bala.ganesh at accenture.com
Mon May 30 10:09:06 EDT 2011


Is there a simplified way of mapping than what i have done???

Java function :
function boolean checkIfVia(Route route, String locationCode)
{
  if(route != null)
 {
   Via[] viaArr = route.getViaArray();
   for(int i=1; i < viaArr.length; i++)
   {
      if(viaArr[i].getLocation().equalsIgnoreCase(locationCode))
          return true; 
      else 
           return false;
   }
 }
 return false;
}




Dsl Mapping:

[keyword][][Ff][Uu][Nn][Cc]
[Cc][Hh][Ee][Cc][Kk][Ii][Ff][Vv][Ii][Aa]=function boolean checkIfVia(Route
route, String locationCode)\n{checkIfViaBody}
[keyword][]checkIfViaBody=\nif(route != null)\n{checkIfViaIfBlock}\nreturn
false;\n
[keyword][]checkIfViaIfBlock=\nVia[] viaArr = route.getViaArray();\nfor(int
i=1; i < viaArr.length; i++)\n{checkIfViaForBlock}\n
[keyword][]checkIfViaForBlock=\nif(viaArr[i].getLocationCode().equalsIgnoreCase(locationCode))\n
return true; \nelse \nreturn false;\n




-----
Thanks,
Bala
--
View this message in context: http://drools.46999.n3.nabble.com/Clarification-needed-in-writing-DSL-function-mapping-tp3002064p3002064.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list