summaryrefslogtreecommitdiffstats
path: root/policy-core/drools-artifact-1.2/src/main/resources/rules.drl
blob: e69b659716efde9c493492bcf2001d7171f8a885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.onap.policy.drools.core.test;

rule "Initialization"
	when
	then
	{
	  System.out.println("Initialization rule running");
	}
end

rule "Multiply elements of an int array"
	when
		$object : Object()
	then
	{
	  if ($object instanceof int[])
		{
		  int[] array = (int[])($object);

		  System.out.println("Received array of length " + array.length);
		  int product = 1;
		  for (int i = 1 ; i < array.length ; i += 1)
			{
			  product *= array[i];
			}
		  array[0] = product;
		}
	}
end