Specialized Administration > Tailoring Business Objects > Object Initialization Rules Administration > Working with Object Initialization Rules > Rule Algorithms > Conditional Logic Algorithms > Test Algorithms
  
Test Algorithms
The out-of-the-box test algorithms are as follows:
Algorithm
Description
wt.rule.algorithm.EqualsTest
Given two objects, determine the equality. This is an object-to-object comparison.
Return TRUE if there is a match; otherwise, return FALSE.
wt.rule.algorithm.StringEqualsTest
Given an attribute and value determine the equality. The algorithm forces everything to be a string using toString( ) before the comparison. This string-to-string comparison is case insensitive.
Return TRUE if there is a match; otherwise, return FALSE.
wt.rule.algorithm.StringRegExEqualsTest
Given an attribute and a value, with \u201c*\u201d in the value, determine the equality using regular expression-related concepts. This algorithm uses the java.util.regex implementation of regular expression matching. The algorithm forces the first Arg tag value to be a string using toString( ) before doing the comparison.
The return is TRUE if it finds a match and the match is the whole string argument.
wt.rule.algorithm.IfNullTest
Given the value of an attribute, determine if the value is a null value.
Return TRUE if the first argument is a null value; otherwise, return FALSE.
To return a null value, use the wt.rule.algorithm.GetNullValue algorithm.
wt.rule.algorithm.IfNotNullTest
Given the value of an attribute, determine if the value is not a null value.
Return TRUE if the first argument is not a null value; otherwise, return FALSE.
To return a null value, use the wt.rule.algorithm.GetNullValue algorithm.
com.ptc.core.rule.server.impl.IfContainerTypeEqualsProjectTest
Given the context in which the object resides, determine if the context is a wt.projmgmt.admin.Project2 context.
Return TRUE if the context is an instance of the wt.projmgmt.admin.Project2 class or subclass or subtype of the Project2 class; otherwise, return FALSE.
The algorithm returns TRUE if the context is either a project or a program context.
wt.rule.algorithm.AndTest
Given two or more comparisons, return TRUE if all comparisons return true; otherwise, return FALSE.
wt.rule.algorithm.OrTest
Given two or more comparisons, return TRUE if any comparison returns true; otherwise, return FALSE.
wt.rule.algorithm.StringInListTest
Takes a list of values and tests if the first value defined in an Attr tag is equal to any of the other items in the list that are defined in Arg tags. The algorithm forces everything to be a string using toString() before doing the comparison.
Return TRUE if there is a match; otherwise, return FALSE.
com.ptc.windchill.enterprise.impl.OrgNameEqualsTest
Given the name of an owning organization participant (which is the value stored in the organization.id attribute) and a string naming an organization, return TRUE if the value of organization.id attribute is the same as the string; otherwise, return FALSE. For more information, see Owning Organization Participants.
The general syntax for using the EqualsTest, StringEqualsTest, and StringRegExEqualsTest algorithms is:
<Value algorithm="wt.rule.algorithm.xxxEqualsTest">
<Attr id="aaa"/>
<Arg>bbb</Arg>
</Value>
In this syntax, the attribute being evaluated is specified in the Attr tag and its string value is in the Arg tag. In this syntax and others described later, the value does not need to be a string; the value can be generated using another algorithm. For example, the following XML could be used to test for a Null value:
<Value algorithm="wt.rule.algorithm.EqualsTest">
<Attr id="name"/>
<Value algorithm="wt.rule.algorithm.GetNullValue"/>
</Value>
The general syntax for StringInList algorithm builds off of the previous syntax:
<Value algorithm="wt.rule.algorithm.StringInList">
<Attr id="aaa"/>
<Arg>bbb</Arg>
<Arg>ccc</Arg>
<Arg>ddd</Arg>
<Arg>eee</Arg>
:
</Value>
Using this syntax as a guide, specify an Arg tag for each item in the list after the first item which is defined in the Attr tag.
The syntax for the AndTest algorithm consists of multiple nested Value tags, where each Value tag is evaluated and all evaluations must be true for the AndTest result to be TRUE.
The syntax for the OrTest algorithm consists of multiple nested Value tags, where each Value tag is evaluated and at least one must be true for the OrTest algorithm result to be TRUE.
Generally, the Value tags used within an AndTest or OrTest algorithm contain other conditional logic algorithms.