Searches the specified array (or vector) for the first occurrence of an element that complies with the filter condition.
Parameters:
elements
The array (or vector) to be searched.Note: The array (or vector) is expected to contain objects representing DSM (Data Source Model) elements, that is
GOMElement
orDSMElement
objects. Objects of any other types will be ignored.
filterQuery
Specify the filter condition on the returned element.This should be a boolean subquery created with
BooleanQuery()
function. The subquery will be processed against each initially selected element. It must returntrue
if the element should be returned andfalse
if it should be ignored. The tested element is passed as the generator context element.
Returns:
The first element in the specified array (or vector) that complies with the filter condition.If no such an element found (or
elements == null
), the function returnsnull
.
Example:
The following expression searched the specified vector (or array)
for the first occurrence of an element with 'xs:group'
type:
Note, that expression returns actually the same result as the call:findElementByFilter( elements, BooleanQuery (instanceOf ("xs:group")) )
findElementByType (elements, "xs:group")
See Also:
BooleanQuery(), findElementByType()