All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xworker.system.rule.RuleSystem.dml Maven / Gradle / Ivy

The newest version!
%1649421839923
@
sname=RuleSystem
slabel=RuleSystem
sdescriptors=xworker.lang.MetaDescriptor3
sextends=xworker.lang.actions.SelfAction
smany=true
seditCols=2
sinitialization=false
sgroup=system.rule
smodifier=public
sinheritDescription=false
Sdescription=
#$@text#$@

规则系统。

执行规则

     遍历规则(Rules)子节点的子节点,执行其accept方法,如果返回true那么执行它的run方法。

循环

    如果loop=true,那么执行一遍后继续执行。如果breakOnNoRules=true,那么在循环结束后跳出循环,跳出循环后系统即终止了。循环时可以设置间隔。

可以重写的方法

  • boolean isLoop(Thing system, boolean hasRule)
    是否要循环执行。hasRule是上次循环中是否有规则被执行。
     
  • boolean isBreak(Thing system, boolean hasRule)
    是否要终止。hasRule是上次循环中是否有规则被执行。
     
  • long getInterval()
    循环之间的间隔。

 

#$@text#$@ snotXmlAttribute=false sjson_isArray=false sth_createIndex=true sth_registMyChilds=false sth_registDisabled=false sth_noThingRegistViewer=false sth_fileMonitor=false sth_deprecated=false sth_mark=false sth_registQueryOnlySelf=false @/@actions sname=actions sdescriptors=xworker.lang.MetaDescriptor3/@actions sinheritDescription=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=actions @/@actions/@run sname=run sisSynchronized=false sthrowException=true suseOtherAction=false svarScope=Local sdisableGlobalContext=false Scode= #$@text#$@ import xworker.lang.util.UtilData; //设置本地变量范围 actionContext.peek().setVarScopeFlag(); //执行初始化 for(inits in self.getChilds("Inits")){ for(init in inits.getChilds()){ init.doAction("run", actionContext); } } //执行规则 while(true){ boolean hasRule = false; for(rules in self.getChilds("Rules")){ for(rule in rules.getChilds()){ if(UtilData.isTrue(rule.doAction("accept", actionContext))){ hasRule = true; rule.doAction("run", actionContext); } } } //是否是循环的 if(self.doAction("isLoop", actionContext, "system", self, "hasRule", hasRule)){ break; } //是否终止循环 if(self.doAction("isBreak", actionContext, "system", self, "hasRule", hasRule)){ break; } def interval = self.doAction("getInterval", actionContext); if(interval > 0){ Thread.sleep(interval); } } #$@text#$@ sinterpretationType=Action screateLocalVarScope=false ssaveReturn=false sswitchResult=false sdebugLog=false sdescriptors=xworker.lang.actions.Actions/@GroovyAction sinheritDescription=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=run @/@actions/@isBreak sname=isBreak sisSynchronized=false sthrowException=true suseOtherAction=false svarScope=Local sdisableGlobalContext=false Scode= #$@text#$@ //默认系统循环没有规则执行,且breakOnNoRules属性值为true if(!hasRule && system.getBoolean("breakOnNoRules")){ return true; }else{ return false; } #$@text#$@ sinterpretationType=Action screateLocalVarScope=false ssaveReturn=false sdebugLog=false sdescriptors=xworker.lang.actions.Actions/@GroovyAction sinheritDescription=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=isBreak @/@actions/@isLoop sname=isLoop sattributeName=loop sinterpretationType=Self sattributeTemplate=false schildsAttributeTemplate=false svarScope=Local sisSynchronized=false sthrowException=true screateLocalVarScope=false ssaveReturn=false sdisableGlobalContext=false sdebugLog=false sdescriptors=xworker.lang.actions.ActionUtil/@GetBoolean sinheritDescription=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=isLoop @/@actions/@getInterval sname=getInterval sattributeName=interval sinterpretationType=Self sattributeTemplate=false schildsAttributeTemplate=false svarScope=Local sisSynchronized=false sthrowException=true screateLocalVarScope=false ssaveReturn=false sdisableGlobalContext=false sdebugLog=false sdescriptors=xworker.lang.actions.ActionUtil/@GetLong sinheritDescription=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=getInterval @/@name sname=name sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=name @/@label sname=label sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=label @/@loop sname=loop sinputtype=truefalse sshowLabel=true sreadOnly=false sdefault=true sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=loop @/@breakOnNoRules sname=breakOnNoRules sinputtype=truefalse sshowLabel=true sreadOnly=false sdefault=true sinheritDescription=false sdescription=

是否在没有Rule匹配时中断循环。

svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=breakOnNoRules @/@interval sname=interval sshowLabel=true sreadOnly=false sinheritDescription=false sdescription=

循环之间的间隔,单位毫秒。。

svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=interval @/@description sname=description sinputtype=html sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=description @/@Rules sname=Rules sdescriptors=xworker.lang.MetaDescriptor3/@thing smany=true seditCols=2 sinitialization=false smodifier=public sinheritDescription=false snotXmlAttribute=false sjson_isArray=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=Rules @/@Rules/@name sname=name sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=name @/@Rules/@label sname=label sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=label @/@Rules/@description sname=description sinputtype=html sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=description @/@Inits sname=Inits sdescriptors=xworker.lang.MetaDescriptor3/@thing smany=true seditCols=2 sinitialization=false smodifier=public sinheritDescription=false snotXmlAttribute=false sjson_isArray=false sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=Inits @/@Inits/@name sname=name sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=name @/@Inits/@label sname=label sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=label @/@Inits/@descriptoin sname=descriptoin sinputtype=html sshowLabel=true sreadOnly=false sinheritDescription=false svalidateAllowBlank=true LvalidateOnBlur=true LallowDecimals=true LallowNegative=true snotXmlAttribute=false sdescriptors=xworker.lang.MetaDescriptor3/@attribute sth_createIndex=false sth_registMyChilds=false sth_registDisabled=false sth_mark=false sid=descriptoin




© 2015 - 2025 Weber Informatics LLC | Privacy Policy