Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.plugtree.examples;
- import org.plugtree.examples.model.OutRecord;
- declare InRecord
- firstname: String
- lastname: String
- age: Integer
- length: Integer
- end
- global OutRecord outRecord;
- rule "Calc length"
- salience 1
- when
- $rec : InRecord(length==null)
- then
- $rec.length = $rec.firstname.length()+$rec.lastname.length();
- update($rec);
- end
- rule "Max Age"
- when
- $oldest: InRecord( $oldAge: age!=null)
- not(InRecord(age> $oldAge))
- then
- $oldest.firstname;
- ...
- outRecord.setValue("MaxAge", $maxAge);
- end
- rule "Longest Name"
- when
- $longest : InRecord( $longLegnth : length !=null)
- not(InRecord(length > $longLength))
- then
- $longest.firstname;
- ...
- outRecord.setValue("MaxAge", $maxAge);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement