3. ANTECEDENTES
3.5. Transesterificación de los aceites para su uso como biocombustibles
3.5.2. Obtención de biodiesel a partir de aceites vegetales sin usar
3.5.2.4. Transesterificación. Purificación del biodiesel
Expressions can also be joined to one another with operators to create compound expressions. Apex supports the following operators:
Description Syntax
Operator
Assignment operator (Right associative). Assigns the value of y to the L-value x. Note that the data type of x must match the data type of y, and cannot be null.
x = y
=
Addition assignment operator (Right associative). Adds the value of y to the original value of x and then reassigns the new value to x. See + for additional information. x and y cannot be null.
x += y +=
Multiplication assignment operator (Right associative). Multiplies the value of y with the original value of x and then reassigns the new value to x. Note x *= y
*=
that x and y must be Integers or Doubles, or a combination. x and y cannot be null.
Subtraction assignment operator (Right associative). Subtracts the value of y from the original value of x and then reassigns the new value to x. Note x -= y
-=
that x and y must be Integers or Doubles, or a combination. x and y cannot be null.
Division assignment operator (Right associative). Divides the original value of x with the value of y and then reassigns the new value to x. Note that x x /= y
/=
and y must be Integers or Doubles, or a combination. x and y cannot be null.
OR assignment operator (Right associative). If x, a Boolean, and y, a Boolean, are both false, then x remains false. Otherwise, x is assigned the value of true.
Note:
x |= y
|=
• This operator exhibits “short-circuiting” behavior, which means y is evaluated only if x is false.
• x and y cannot be null.
Description Syntax
Operator
AND assignment operator (Right associative). If x, a Boolean, and y, a Boolean, are both true, then x remains true. Otherwise, x is assigned the value of false.
Note:
x &= y
&=
• This operator exhibits “short-circuiting” behavior, which means y is evaluated only if x is true.
• x and y cannot be null.
Bitwise shift left assignment operator. Shifts each bit in x to the left by y bits so that the high order bits are lost, and the new right bits are set to 0.
This value is then reassigned to x. x <<= y
<<=
Bitwise shift right signed assignment operator. Shifts each bit in x to the right by y bits so that the low order bits are lost, and the new left bits are set x >>= y
>>=
to 0 for positive values of y and 1 for negative values of y. This value is then reassigned to x.
Bitwise shift right unsigned assignment operator. Shifts each bit in x to the right by y bits so that the low order bits are lost, and the new left bits are set to 0 for all values of y. This value is then reassigned to x.
x >>>= y
>>>=
Ternary operator (Right associative). This operator acts as a short-hand for if-then-else statements. If x, a Boolean, is true, y is the result. Otherwise z is the result. Note that x cannot be null.
x ? y : z
? :
AND logical operator (Left associative). If x, a Boolean, and y, a Boolean, are both true, then the expression evaluates to true. Otherwise the expression evaluates to false.
Note:
x && y
&&
• && has precedence over ||
• This operator exhibits “short-circuiting” behavior, which means y is evaluated only if x is true.
• x and y cannot be null.
OR logical operator (Left associative). If x, a Boolean, and y, a Boolean, are both false, then the expression evaluates to false. Otherwise the expression evaluates to true.
Note:
x || y
||
• && has precedence over ||
• This operator exhibits “short-circuiting” behavior, which means y is evaluated only if x is false.
• x and y cannot be null.
Description Syntax
Operator
Equality operator. If the value of x equals the value of y, the expression evaluates to true. Otherwise, the expression evaluates to false.
Note:
x == y
==
• Unlike Java, == in Apex compares object value equality, not reference equality. Consequently:
◊ String comparison using == is case insensitive
◊ ID comparison using == is case sensitive, and does not distinguish between 15-character and 18-character formats
• For sObjects and sObject arrays, == performs a deep check of all sObject field values before returning its result. Likewise for collections, built-in Apex types, and user-defined types.
• For records, every field must have the same value for == to evaluate to true.
• x or y can be the literal null.
• The comparison of any two values can never result in null.
• SOQL and SOSL use = for their equality operator, and not ==. Although Apex and SOQL and SOSL are strongly linked, this unfortunate syntax discrepancy exists because most modern languages use = for assignment and == for equality. The designers of Apex deemed it more valuable to maintain this paradigm than to force developers to learn a new assignment operator. The result is that Apex developers must use == for equality tests in the main body of the Apex code, and = for equality in SOQL and SOSL queries.
Exact equality operator. If x and y reference the exact same location in memory, the expression evaluates to true. Otherwise, the expression evaluates x === y
===
to false. Note that this operator only works for sObjects or collections (such as a Map or list). For an Apex object (such as an Exception or instantiation of a class) the exact equality operator is the same as the equality operator.
Less than operator. If x is less than y, the expression evaluates to true.
Otherwise, the expression evaluates to false.
Note:
x < y
<
• Unlike other database stored procedures, Apex does not support tri-state Boolean logic, and the comparison of any two values can never result in null. validated and treated as an ID.
Description Syntax
Operator
• x and y cannot be Booleans.
• The comparison of two strings is performed according to the locale of the context user.
Greater than operator. If x is greater than y, the expression evaluates to true.
Otherwise, the expression evaluates to false.
Note:
x > y
>
• The comparison of any two values can never result in null.
• If x or y equal null and are Integers, Doubles, Dates, or Datetimes, the validated and treated as an ID.
• x and y cannot be Booleans.
• The comparison of two strings is performed according to the locale of the context user.
Less than or equal to operator. If x is less than or equal to y, the expression evaluates to true. Otherwise, the expression evaluates to false.
Note:
x <= y
<=
• The comparison of any two values can never result in null.
• If x or y equal null and are Integers, Doubles, Dates, or Datetimes, the validated and treated as an ID.
• x and y cannot be Booleans.
• The comparison of two strings is performed according to the locale of the context user.
Greater than or equal to operator. If x is greater than or equal to y, the expression evaluates to true. Otherwise, the expression evaluates to false.
Note:
x >= y
>=
• The comparison of any two values can never result in null.
• If x or y equal null and are Integers, Doubles, Dates, or Datetimes, the expression is false.
• A non-null String or ID value is always greater than a null value.
Description validated and treated as an ID.
• x and y cannot be Booleans.
• The comparison of two strings is performed according to the locale of the context user.
Inequality operator. If the value of x does not equal the value of y, the expression evaluates to true. Otherwise, the expression evaluates to false.
Note:
x != y
!=
• Unlike Java, != in Apex compares object value equality, not reference equality.
• For sObjects and sObject arrays, != performs a deep check of all sObject field values before returning its result.
• For records, != evaluates to true if the records have different values for any field.
• x or ycan be the literal null.
• The comparison of any two values can never result in null.
Exact inequality operator. If x and y do not reference the exact same location in memory, the expression evaluates to true. Otherwise, the expression evaluates x !== y
!==
to false. Note that this operator only works for sObjects, collections (such as a Map or list), or an Apex object (such as an Exception or instantiation of a class).
Addition operator. Adds the value of x to the value of y according to the following rules:
x + y +
• If x and y are Integers or Doubles, adds the value of x to the value of y. If a Double is used, the result is a Double.
• If x is a Date and y is an Integer, returns a new Date that is incremented by the specified number of days.
• If x is a Datetime and y is an Integer or Double, returns a new Date that is incremented by the specified number of days, with the fractional portion corresponding to a portion of a day.
• If x is a String and y is a String or any other type of non-null argument, concatenates y to the end of x.
Subtraction operator. Subtracts the value of y from the value of x according to the following rules: by the specified number of days.
Description Syntax
Operator
• If x is a Datetime and y is an Integer or Double, returns a new Date that is decremented by the specified number of days, with the fractional portion corresponding to a portion of a day.
Multiplication operator. Multiplies x, an Integer or Double, with y, another Integer or Double. Note that if a double is used, the result is a Double.
x * y
*
Division operator. Divides x, an Integer or Double, by y, another Integer or Double. Note that if a double is used, the result is a Double.
x / y /
Logical complement operator. Inverts the value of a Boolean, so that true becomes false, and false becomes true.
!x
!
Unary negation operator. Multiplies the value of x, an Integer or Double, by -1. Note that the positive equivalent + is also syntactically valid, but does not have a mathematical effect.
-x
-Increment operator. Adds 1 to the value of x, a variable of a numeric type.
If prefixed (++x), the expression evaluates to the value of x after the increment.
x++
++x ++
If postfixed (x++), the expression evaluates to the value of x before the increment.
Decrement operator. Subtracts 1 from the value of x, a variable of a numeric type. If prefixed (--x), the expression evaluates to the value of x after the
x----x
--decrement. If postfixed (x--), the expression evaluates to the value of x before the decrement.
Bitwise AND operator. ANDs each bit in x with the corresponding bit in y so that the result bit is set to 1 if both of the bits are set to 1. This operator is not valid for types Long or Integer.
x & y
&
Bitwise OR operator. ORs each bit in x with the corresponding bit in y so that the result bit is set to 1 if at least one of the bits is set to 1. This operator is not valid for types Long or Integer.
x | y
|
Bitwise exclusive OR operator. Exclusive ORs each bit in x with the corresponding bit in y so that the result bit is set to 1 if exactly one of the bits is set to 1 and the other bit is set to 0.
x ^ y
^
Bitwise exclusive OR operator. Exclusive ORs each bit in x with the corresponding bit in y so that the result bit is set to 1 if exactly one of the bits is set to 1 and the other bit is set to 0.
x ^= y
^=
Bitwise shift left operator. Shifts each bit in x to the left by y bits so that the high order bits are lost, and the new right bits are set to 0.
x << y
<<
Bitwise shift right signed operator. Shifts each bit in x to the right by y bits so that the low order bits are lost, and the new left bits are set to 0 for positive values of y and 1 for negative values of y.
x >> y
>>
Bitwise shift right unsigned operator. Shifts each bit in x to the right by y bits so that the low order bits are lost, and the new left bits are set to 0 for all values of y.
x >>> y
>>>
Description Syntax
Operator
Parentheses. Elevates the precedence of an expression x so that it is evaluated first in a compound expression.
(x) ()