📄 state.python.drl
字号:
<?xml version="1.0"?><rule-set name="State Example" xmlns="http://drools.org/rules" xmlns:python="http://drools.org/semantics/python" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://drools.org/rules rules.xsd http://drools.org/semantics/python python.xsd"> <python:import>from org.drools.examples.state import State</python:import> <rule name="Bootstrap"> <parameter identifier="a"> <class-field field="name" value="A">State</class-field> </parameter> <python:condition>a.getState() == "NOTRUN"</python:condition> <python:consequence> print "%s finished" % a.getName(); a.setState("FINISHED"); </python:consequence> </rule> <rule name="AtoB"> <parameter identifier="a"> <class-field field="name" value="A">State</class-field> </parameter> <parameter identifier="b"> <class-field field="name" value="B">State</class-field> </parameter> <python:condition>a.getState() == "FINISHED"</python:condition> <python:condition>b.getState() == "NOTRUN"</python:condition> <python:consequence> print "%s finished" % b.getName(); b.setState("FINISHED"); </python:consequence> </rule> <rule name="BtoC"> <parameter identifier="b"> <class-field field="name" value="B">State</class-field> </parameter> <parameter identifier="c"> <class-field field="name" value="C">State</class-field> </parameter> <python:condition>b.getState() == "FINISHED"</python:condition> <python:condition>c.getState() == "NOTRUN"</python:condition> <python:consequence> print "%s finished" % c.getName(); c.setState("FINISHED"); </python:consequence> </rule> <rule name="BtoD"> <parameter identifier="b"> <class-field field="name" value="B">State</class-field> </parameter> <parameter identifier="d"> <class-field field="name" value="D">State</class-field> </parameter> <python:condition>b.getState() == "FINISHED"</python:condition> <python:condition>d.getState() == "NOTRUN"</python:condition> <python:consequence> print "%s finished" % d.getName(); d.setState("FINISHED"); </python:consequence> </rule> </rule-set>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -