23.07.2013 Views

O'Reilly - Java Message Service

O'Reilly - Java Message Service

O'Reilly - Java Message Service

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table D.3. Definition of the OR Operator<br />

Expression Result<br />

TRUE OR TRUE TRUE<br />

TRUE OR FALSE TRUE<br />

TRUE OR Unknown TRUE<br />

FALSE OR Unknown Unknown<br />

Unknown OR Unknown Unknown<br />

Table D.4. Definition of the NOT Operator<br />

Expression Result<br />

NOT TRUE FALSE<br />

NOT FALSE TRUE<br />

NOT Unknown Unknown<br />

<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />

To avoid problems, the IS NULL or IS NOT NULL comparison can be used to check for the<br />

existence of a property:<br />

Age IS NULL AND Weight IS NOT NULL<br />

The previous expression selects messages that do not have an Age property but do have a<br />

Weight property.<br />

D.4 Arithmetic Operators<br />

In addition to normal comparison operators, message selectors can use arithmetic operators<br />

to calculate values for evaluation dynamically at runtime. Table D.5 shows the arithmetic<br />

operators in their order of precedence.<br />

Table D.5. Arithmetic Operators<br />

Type Symbol<br />

Unary<br />

Multiplication and division<br />

Addition and subtraction<br />

For example, the following expression applies arithmetic operations to the Age, Height, and<br />

Weight properties to select people who have a weight outside a certain range:<br />

Weight NOT BETWEEN (Age * 5) AND (Height/Age * 2.23)<br />

+, -<br />

*, /<br />

+, -<br />

177

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!