Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.74 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.     length: Integer
  10. end
  11.  
  12. global OutRecord outRecord;
  13.  
  14. rule "Calc length"
  15. salience 1
  16. when
  17.     $rec : InRecord(length==null)
  18. then
  19.     $rec.length = $rec.firstname.length()+$rec.lastname.length();
  20.     update($rec);
  21. end
  22.  
  23. rule "Max Age"
  24.     when
  25.         $oldest: InRecord( $oldAge: age!=null)
  26.         not(InRecord(age> $oldAge))
  27.     then
  28.         $oldest.firstname;
  29.         ...
  30.         outRecord.setValue("MaxAge", $maxAge);
  31. end
  32.  
  33. rule "Longest Name"
  34.     when
  35.         $longest : InRecord( $longLegnth : length !=null)
  36.         not(InRecord(length > $longLength))
  37.     then
  38.         $longest.firstname;
  39.         ...
  40.         outRecord.setValue("MaxAge", $maxAge);
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement