honestpolitician.drl

来自「jboss规则引擎」· DRL 代码 · 共 39 行

DRL
39
字号
package org.drools.examples
 
import org.drools.examples.HonestPoliticianExample.Politician;
import org.drools.examples.HonestPoliticianExample.Hope;
 
rule "We have an honest Politician"
	when
		exists( Politician( honest == true ) )
	then
		assertLogical( new Hope() );
end

rule "Hope Lives"
    salience 10
	when
		exists( Hope() )
	then
		System.out.println("Hurrah!!! Democracy Lives");
end

rule "Hope is Dead"
	when
		not( Hope() )
	then
		System.out.println( "We are all Doomed!!! Democracy is Dead" );
end

rule "Currupt the Honest"
   salience 5
	when
		politician : Politician( honest == true )	
		exists( Hope() )
	then
	    System.out.println( "I'm an evil corporation and I have corrupted " + politician.getName() );
		politician.setHonest( false );
		modify( politician );
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?