⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 honestpolitician.drl

📁 jboss规则引擎
💻 DRL
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -