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

📄 helloworld.groovy.drl

📁 drools 一个开放源码的规则引擎
💻 DRL
字号:
<?xml version="1.0"?>

<rule-set name="helloworld"
          xmlns="http://drools.org/rules"
          xmlns:groovy="http://drools.org/semantics/groovy"
          xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
          xs:schemaLocation="http://drools.org/rules rules.xsd
                             http://drools.org/semantics/groovy groovy.xsd">

  <import>java.lang.Object</import>
  <import>java.lang.String</import>

  <groovy:functions>
  	static def helloWorld(String hello)
  	{
  		println hello + " World";
  	}

  	static def goodbyeWorld(String goodbye)
  	{
  		println goodbye + " Cruel World";
  	}
  </groovy:functions>

  <rule name="Hello World">
    <parameter identifier="hello">
      <class>String</class>
    </parameter>

    <groovy:condition>hello.equals("Hello")</groovy:condition>

    <groovy:consequence>
      helloWorld(hello);
    </groovy:consequence>
  </rule>

  <rule name="Goodbye Cruel World">
    <parameter identifier="goodbye">
      <class>String</class>
    </parameter>

    <groovy:condition>goodbye.equals("Goodbye")</groovy:condition>

    <groovy:consequence>
      goodbyeWorld(goodbye)
    </groovy:consequence>
  </rule>

  <rule name="Debug">
    <parameter identifier="object">
      <class>Object</class>
    </parameter>

    <groovy:consequence>
      println "Asserted object: " + object ;
    </groovy:consequence>
  </rule>

</rule-set>

⌨️ 快捷键说明

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