向规则类的顶部添加下列代码。
列表3是一个显示如何执行规则类的代码片段。
Listing 3 is a code snippet that shows how you can implement a rule class.
规则类是十分简单的,典型情况下只包含一个方法。
The rule class is quite simple, typically containing only a single method.
类域中包含您先前所创建的规则类的名称。
The class field contains the qualified name of the rule class that you created earlier. The category field contains the identifier string for your Examples category.
本例中的规则类,如同在同一行中定义多个变量,例如
The rule class in this example will look for C++ code that declares multiple variables on the same line. For example
所有的规则类必须扩展转换框架定义的abstractrule类。
Any rule class must extend the AbstractRule class defined by the transformation framework.
在您详细察看转换之前,我们先要修正规则类,使其能够调用刚刚产生的类。
Before you look in detail at the transform, amend the rule class to invoke this generated class.
您可能会想,添加一条新规则,要比创建规则类和向插件添加一个扩展容易。
As you might expect, adding a new rule is a simple matter of creating a rule class and adding an extension to the plug-in.
每个规则类都实现了Rule Implementor接口,该接口包含两个方法:fire和init。
Each rule class implements the RuleImplementor interface which includes two methods: fire and init.
在规则类被完成之后,它需要通过在分析架构中的所提供的扩展点被描述出来,从而使得代码评审引擎能够将其发现。
After the rule class is completed, it needs to be described through the provided extension points in the analysis framework so that the code review engine can discover it.
考虑一下如何将此规则应用于方法和类。
更改规则实现类。
如果需求、规章、策略或规则覆盖模型中的很多类、流程中的很多任务,分离出来的规则就要被明确地表示出来。
If a requirement, regulation, policy or rule spans many classes in the model and many tasks within the process, externalized rules are strongly indicated.
可以看到,样式表规则使用ID、类和元素选择器匹配清单1的各部分内容。
You can see the rules using ID, class, and element selectors matching parts of Listing 1.
哪类规则执行得较快?
调用该方法执行先前加载到类构造函数中的规则。
Invoking this method executes the rules that were previously loaded in the class's constructor.
例子是用例、用例模型、业务规则、类、类图、序列图、数据模型和补充规约。
Examples are use cases, use case models, business rules, classes, class diagrams, sequence diagrams, the data model, and supplementary specifications.
定义代表规则的类。
JVM规范中详细描述了装入类的规则。
The rules for loading classes are spelled out in detail in the JVM specification.
宽泛地讲,该应用程序中所用的业务规则分为两类。
Broadly, the business rules used in this application fall into two categories.
在这个例子中,class属性包含一个用于规则的完整的类路径。
In this case, the class attribute contains a fully qualified class path for the rule.
正如您所猜到的一样,classname参考了定义规则的实际类。
As you might have guessed, the class name refers to the actual class that defines the rule.
ValidationRule是规则引擎的抽象类,用来验证并格式化ViewController字段内容。
ValidationRule is an abstract class for a rule engine used to validate and format ViewController field content.
示例程序使用Drools规则引擎对machine类的实例求值。
The sample program USES the Drools rules engine to evaluate instances of the Machine class.
如果违反了以上任何一条规则,那么类装入器就会抛出ClassCastException。
If either of the above rules are violated, then a ClassCastException is thrown by the class loader.
该文件应当包含一组完全符合规则的插件类名,其中每行显示一个类名。
This file should contain a list of the fully qualified plug-in class names, one per line.
以odr为中心的路由规则不应与在应用程序工作类上设置的路由规则混淆。
The ODR centric routing rules should not be confused with the routing rules set at the application work class.
一旦一个规则命令类被创建,它将在特定的规则引擎上被触发且执行正确的规则。
Once this rule command class is created, it is triggered to execute the correct rule in that specific rule engine.
每一步表达了一个新的映射规则,并解释了相关的概念;在需要的地方有类图描述规则。
Each step presents a new mapping rule and explains the related concepts; where meaningful, a class diagram illustrates the rule.
每一步表达了一个新的映射规则,并解释了相关的概念;在需要的地方有类图描述规则。
Each step presents a new mapping rule and explains the related concepts; where meaningful, a class diagram illustrates the rule.
应用推荐