Operators

Set Operators
Logical Operators
Value Operators

The language supports set operators, logical operators, and value operators.

Set Operators

Set operators combine two set expressions or two transforms in different ways:

union

The union operator combines all the elements of two sets. The following transform will return all method calls or field references to members of a class:

set CallOrRefTransform to ( calls to methods in ) union ( references to fields in )
intersection

The intersection operator creates a set containing only those elements that appear in both operand sets. The following set expression will return calls to a class that come from methods in the class:

( calls to intersection calls from ) methods in class "ObjectDB"
without

The without operator creates a set containing only those elements in the first operand set that do not also exist in the second operand set. This operation is sometimes referred to as "difference". The following set expression will return calls to class that come from methods outside the class:

( calls to without calls from ) methods in class "ObjectDB"
deintersection

The deintersection operator creates a set containing only those elements that appear in one of the operand sets that don't appear in both operand sets. This operation is sometimes referred to as "symmetric difference".

Logical Operators

Logical operators let you combine filters into different filters.

and

The and operator results in a filter that passes a value only if it passes both operand filters.

or

The or operator results in a filter that passes a value if either of the operand filters pass the value.

xor

The xor operator results in a filter that passes a value if either of the operand filters, but not both, pass the value.

not

The not operator applies to a single filter and changes its sense, so that it rejects values it would pass and passes values it would reject.

Value Operators

There are two kinds of operators that work only with value expressions: relational operators and value operators.

Relational Operators

BBQ supports relational operators that compare two value expressions; the result of the comparison is a filter. The = and != operators can compare any value expression type; the relational operators < <= >= > can only compare values of type integer, string, or date.

There is an additional relational operator ~= that produces a filter by matching a string value with a second string value interpreted as a Java regular expression. The following set expression looks for strings that match "select", regardless of case:

to string ~= //(?i)select/ all strings

Value Expression Operators

Value operators combine two value expressions into a single value expression.

BBQ currently defines only one value operator, &. This operator concatenates two string-type expressions.

browse-by-query home antlersoft free software sourceforge project page