Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. package org.plugtree.examples;
  2.  
  3. import org.plugtree.examples.model.OutRecord;
  4.  
  5. declare InRecord
  6. firstname: String
  7. lastname: String
  8. age: Integer
  9. end
  10.  
  11. global OutRecord outRecord;
  12.  
  13.  
  14. rule "Maximum Age"
  15. when
  16. $maxAge : Number() from accumulate(
  17. InRecord($age: age),
  18. max($age))
  19. $record : InRecord(age ==$age)
  20. then
  21. //Use $record here. it has the max age
  22. outRecord.setValue("MaxAge", $maxAge);
  23. end
  24.  
  25.  
  26. rule "Longest Name"
  27. when
  28. $n : Number() from accumulate(
  29. InRecord($first : firstname, $last : lastname),
  30. max($first.length() + $last.length()) )
  31. $record : InRecord(firstname ==$first, lastname ==$last)
  32. then
  33. outRecord.setValue("Longest", $n);
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement