Operatoren
Operatoren ermöglichen das Erstellen von Ausdrücken durch Modifizieren oder Berechnen von Werten aus anderen, die als "Operanden" bezeichnet werden.
Abhängig von der Art der durchzuführenden Operation und/oder dem Datentyp, auf den sie angewendet werden, können Operatoren wie folgt klassifiziert werden:
- Arithmetische Operatoren. Werden bei mathematischen Operationen angewendet, und das Ergebnis ihrer Anwendung ist immer eine Zahl.
- Logische Operatoren. Werden bei logischen Operationen angewendet, und das Ergebnis ihrer Anwendung ist immer ein boolescher Wert (true / false).
- String-Operatoren. Werden auf Zeichenketten angewendet, und das Ergebnis ihrer Anwendung ist immer ein String-Wert.
- Relationale Operatoren. Werden bei Vergleichsoperationen angewendet, und das Ergebnis ihrer Anwendung ist immer ein boolescher Wert (true / false).
Zusätzlich können Operatoren abhängig von der Anzahl der Operanden, auf die der Operator wirkt, wie folgt klassifiziert werden:
- Unäre Operatoren. Diese Operatoren wirken auf einen einzelnen Operanden.
- Binäre Operatoren. Diese Operatoren wirken auf zwei Operanden.
Die folgende Tabelle fasst die Liste aller in der CS Gear-Plattform verfügbaren Operatoren zusammen, klassifiziert nach Operationstyp. In jedem Fall können zusätzliche Informationen durch Klicken auf den jeweiligen Operator abgerufen werden.
Arithmetische Operatoren
Arithmetische Operatoren werden bei mathematischen Operationen angewendet, und das Ergebnis ihrer Anwendung ist immer eine Zahl.
| Operator | Explanation | Unary / Binary |
|---|---|---|
| + | Adds the two numbers on each side of the operator. | Binary |
| - | Takes the number to the left of the operator and subtracts the number to the right of the operator. | Binary |
| * | Multiplies the two numbers on both sides of the operator. | Binary |
| / | Takes the number to the left of the operator and divides it by the number to the right of the operator. | Binary |
| MOD | Takes the number to the left of the operator, divides it by the number to the right of the operator, and returns the remainder of the division. | Binary |
| - | Sign change. This unary operator changes the sign of the operand to its right. | Unary |
| NOT | Takes the number given as a parameter, considered as a 32-bit integer, and inverts all bits. Commonly known as "bitwise NOT". | Unary |
| AND | Takes the operands on both sides of the operator, considered as 32-bit integers, and performs a logical AND operation for each bit of both operands. Commonly known as "bitwise AND". | Binary |
| OR | Takes the operands on both sides of the operator, considered as 32-bit integers, and performs a logical OR operation for each bit of both operands. Commonly known as "bitwise OR". | Binary |
| XOR | Takes the operands on both sides of the operator, considered as 32-bit integers, and performs a logical XOR operation for each bit of both operands. Commonly known as "bitwise XOR". | Binary |
Logische Operatoren
Logische Operatoren werden bei logischen Operationen angewendet, und das Ergebnis ihrer Anwendung ist immer ein boolescher Wert (true / false).
| Operator | Explanation | Unary / Binary |
|---|---|---|
| NOT | Computes the complement of the operand to the right of the operator. If the operand is true, the result is false and vice versa. | Unary |
| AND | Computes the logical AND operation between the operands on both sides of the operator. The AND operation results in a true value only when both operands have a true value, and false otherwise. | Binary |
| OR | Computes the logical OR operation between the operands on both sides of the operator. The OR operation results in a true value if at least one of the operands has a true value, and false in any other case. | Binary |
| XOR | Computes the logical XOR operation between the operands on both sides of the operator. The XOR operation results in a true value if only one of the operands has a true value, and false in any other case. | Binary |
String-Operatoren
String-Operatoren werden auf Zeichenketten angewendet, und das Ergebnis ihrer Anwendung ist immer ein String-Wert.
| Operator | Explanation | Unary / Binary |
|---|---|---|
| + | Concatenates (joins) the operands on both sides of the operator, using the left one first, and then concatenating the right one. | Binary |
Relationale Operatoren
Relationale Operatoren werden bei Vergleichsoperationen angewendet, und das Ergebnis ihrer Anwendung ist immer ein boolescher Wert (true / false). Sie können auf jeden Datentyp angewendet werden, aber in allen Fällen müssen beide Operanden vom gleichen Typ sein. Es ist wichtig, sich einige Vergleichsregeln zu merken:
- Beim Vergleich von booleschen Werten wird der Wert true als größer als der Wert false betrachtet.
- Bei String-Werten wird eine Zeichenkette als größer als eine andere betrachtet, wenn sie alphabetisch nach der anderen sortiert wird.
| Operator | Explanation | Unary / Binary |
|---|---|---|
> | Compares the operands on both sides of the operator and returns true when the left operand is greater than the right one. | Binary |
>= | Compares the operands on both sides of the operator and returns true when the left operand is greater than or equal to the right one. | Binary |
< | Compares the operands on both sides of the operator and returns true when the left operand is less than the right one. | Binary |
<= | Compares the operands on both sides of the operator and returns true when the left operand is less than or equal to the right one. | Binary |
= | Compares the operands on both sides of the operator and returns true when both are equal. | Binary |
<> | Compares the operands on both sides of the operator and returns true when both are different. | Binary |
Datumsformate
Die Plattform ermöglicht eine gewisse Flexibilität bei der Verwendung von Datums-/Zeitfeldern in den HTTP- und MQTT-APIs. Felder sind immer vom Typ String, aber der Inhalt kann unter Verwendung der hier beschriebenen Formate angegeben werden.
Arithmetische Operatoren
Arithmetische Operatoren werden in mathematischen Operationen angewendet, und das Ergebnis ihrer Anwendung ist immer eine Zahl.