pattern inheritance

PRPC provides two kinds of class inheritance, known as directed inheritance and pattern inheritance. Pattern inheritance, an optional feature you can set up for a class in the Rule-Obj-Class rule, affects the first steps in the rule resolution algorithm. This approach is sometimes called "dual" inheritance.

During rule resolution, pattern inheritance causes a class to inherit rules first from classes that match a prefix of the class name.

Select the Find by name first (Pattern)? check box on the Class rule form to instruct the system to use pattern inheritance for this class. This check box corresponds to the Rule-Obj-Class.pyPatternInheritance property. Pattern inheritance causes the system to search for a rule in classes derived from the current class name by truncating, from the right, alphanumeric segments that follow a hyphen (dash) character.

What is a pattern?

Rule resolution always looks first for a rule it needs in the class initially provided, regardless of the state of the Find by name first (Pattern)? check box. If the box is selected and the rule is not found, rule resolution forms a sequence of candidate classes to search by truncating, from the left, portions of the class name that consist only of a dash character, or consist only of characters other than a dash. If no class exists for one of these computed names, rule resolution continues with the next prefix.

For example, a request for a rule in the WalCare-Financial-Credit class causes the system to search through these classes, in the order indicated:

The algorithm

For a class using pattern inheritance, the following is a simplified description of the rule resolution algorithm:

  1. Search each class formed by repeatedly truncating the original class name, stopping if the needed rule is found.
  2. If the pattern search finishes without finding a rule, go back to the original class and use directed inheritance to find the parent of the original class.
  3. If the parent class identified in step 2 was searched during step 1, skip it and skip to step 5.
  4. If the parent class was not previously searched, search it. Stop if the needed rule is found.
  5. If not found, determine whether the parent class uses pattern inheritance. If so, repeat this algorithm, starting at step 1, with the parent class.
  6. Otherwise, identify the parent of the parent. Continue at step 4.

The ultimate base class @baseclass is searched last.

Example

For example, assume your application requests a rule from WalCare-Financial-Credit, which derives from PegaCare-Financial-Credit, and WalCare-Financial-Credit uses pattern inheritance.

The system searches for the rule as follows:

  1. Is the rule in WalCare-Financial-Credit? If not,
  2. Is the rule in WalCare-Financial- ? If not,
  3. Is the rule in WalCare-Financial ? If not,
  4. Is the rule in WalCare- ? If not,
  5. Is the rule in WalCare ? This is the end of the pattern. If the system still cannot find the rule, it returns to Walcare-Financial-Credit and looks at the parent. If the parent was previously checked because of a similar pattern, it continues with the parent's parent.
  6. Is the rule in PegaCare-Financial-Credit? If not, see if PegaCare-Financial-Credit uses pattern inheritance first. If so, start the sequence again. If not, go next to the parent of PegaCare-Financial-Credit.

Notes

No inheritance occurs for external classes, even when the class name contains a dash character.

Related Topics IconRelated terms