Operators
An operator is a symbol that operates on one or more arguments to produce a result. Various kinds of operators are available on the Expression Builder dialog box.
Arithmetic operators
The following arithmetic operators are used in Integration Composer.
Operator | Description |
---|---|
+ | addition |
- | subtraction |
* | multiplication |
/ | division |
Except for the + operator, all arithmetic operators require a numeric value. The + operator can be used with a string to specify concatenation, as shown in the following examples:
String s1 = "Logon Name: " + 'Computer.Loginname' + " ;";
String s2 = 'ComputerSystem.Manufacturer' + " " +
'ComputerSystem.Model';
String s3 = 'FixedDrives.Driveno' + ":\\";
The final semi-colon in the examples is a statement terminator.
Assignment operator
The assignment operator assigns one value to another, as shown in the following example:
int largestInteger = Integer.MAX_VALUE;
Comparison operators
The following comparison operators are used in Integration Composer.
Operator | Description |
---|---|
< | less than |
<= | less than or equal to |
> | greater than |
>= | greater than or equal to |
= = | is equal to |
!= | is not equal to |
Comparison operators compare two operands in an expression and return a boolean result of true or false. For example, if s=32 and t=64, then the expression s < t would return true, while s==t would return false.
Logical operators
The following logical operators are used in Integration Composer.
Operator | Description |
---|---|
&& | AND |
|| | OR |
! | NOT |
Logical operators let you check for multiple conditions. The && (AND) operator, for example, evaluates two boolean values and returns a boolean value of true only if both values are true. The results of AND and OR logical operators are described in the following table:
Left Operand | Right Operand | && | || |
---|---|---|---|
false | false | false | false |
false | true | false | true |
true | false | false | true |
true | true | true | true |
The following example assumes that both operands are boolean:
`Node.Isserver'&&'Node.Installed'
The logical operator ! (NOT) returns the logical complement of a boolean type; for example, !true=false.
Unary operators
The following unary operators are supported by Integration Composer.
Operator | Description |
---|---|
+ | returns a positive numeric value |
- | returns a negative numeric value |
! | returns the logical
complement of a boolean type
|
Order of calculations
Occasionally, you must use several operators in a single expression. The abridged list describing the order of operations used by Integration Composer is provided in the following table.
Operator | Description |
---|---|
+ - | Unary positive and negative |
! | Unary logical negation |
* / | Multiplication and division |
+ - | Addition and subtraction |
< <= > >= | Inequality |
== != | Equality and inequality |
&& | Logical AND |
|| | Logical OR |
For example, the sequence of calculations for the following expression performs multiplication first,
5 + 5 - 2 * 3
To become
5 + 5 - 6
Then addition, to become
10 - 6
Then subtraction, to become
4
If you want calculations performed in a different sequence, you can use parentheses to control the order of operations, as shown in the following example.
(5 + 5) * 2 - 3
Becomes
10 * 2 - 3 = 20 - 3 = 17
If an expression contains several operators with the same order preference, then the expression is calculated from left to right.