PBDOM_ATTRIBUTE:
Equals method
Description
Tests
for equality between the supplied PBDOM_OBJECT and the PBDOM_ATTRIBUTE
from which the method is invoked.
Syntax
1 |
<span>pbdom_attribute_name.</span>Equals(pbdom_object <span>pbdom_object_ref</span>) |
Argument |
Description |
---|---|
pbdom_attribute_name |
The name of the PBDOM_ATTRIBUTE |
pbdom_object_ref |
A PBDOM_OBJECT to be compared |
Return Values
Boolean. Returns true if
the current PBDOM_ATTRIBUTE is equivalent to the input
PBDOM_OBJECT and false otherwise.
Throws
EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT – If
this PBDOM_ATTRIBUTE does not have or has not been assigned
a user-defined name.
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE – if
the input PBDOM_OBJECT is not a reference to an object
derived from PBDOM_OBJECT.
Examples
The following code uses the Equals method
to test for equivalence between a referenced PBDOM_OBJECT
and a cloned object.
1 |
pbdom_attr = Create PBDOM_Attribute<br>pbdom_attr.SetName("My_Attr")<br>pbdom_attr_clone = pbdom_attr.Clone(true)<br> <br>if (pbdom_attr_clone.Equals(pbdom_attr)) then<br>   MessageBox ("Equals", "Yes")<br>else<br>   MessageBox ("Equals", "No")<br>end if |
The SetName method names the newly created
PBDOM_ATTRIBUTE, which is subsequently cloned with the Clone method.
The Equals method tests for equality between
the cloned PBDOM_ATTRIBUTE pbdom_attr_clone and
the referenced PBDOM_OBJECT pbdom_attr.
A message box displays the result returned from the Equals method.
Note here that because a cloned object is never equivalent
to the object from which it is cloned, the Equals method
returns false.
The following code uses the Equals method
to test for equivalence between two cloned objects.
1 |
pbdom_attr = Create PBDOM_Attribute<br>pbdom_attr.SetName("My_Attr")<br>pbdom_attr_clone = pbdom_attr.Clone(true)<br>pbdom_attr_2 = pbdom_attr_clone<br> <br>if (pbdom_attr_clone.Equals(pbdom_attr_2)) then |
1 |
   MessageBox ("Equals", "Yes")<br>else<br>   MessageBox ("Equals", "No")<br>end if |
A newly created PBDOM_ATTRIBUTE is cloned, and a
reference to this clone is assigned to pbdom_attr_2.
The Equals method tests for equality between
the cloned PBDOM_ATTRIBUTE pbdom_attr_clone and
the reference to it, pbdom_attr_2.
A message box displays the result returned from the Equals method.
Here the Equals method returns true.
Usage
Note that the clone of a PBDOM_ATTRIBUTE is not considered
equal to itself.