Integer Unary Operator
Summary
- Internal name:
IntegerSingleOps - Category: Arithmetic
- Purpose: Apply a unary arithmetic operation on a single integer value and store the result in a workflow variable.
- Task type: Normal
Compatibility
-
Minimum AndroMate version:
1.1.0 -
Maximum AndroMate version:
1.1.0 -
Minimum Android:
Android 13 (API 33) -
Maximum Android tested:
Android 16 (API 36) -
Supported manufacturers:
- ✅ Samsung (One UI 6.x / 7.x / 8.x)
- ✅ Google Pixel (Android Stock)
- ⚠️ Other manufacturers — not tested
-
Required permissions:
- None
Detailed description
The Integer Unary Operator task applies a single arithmetic operation to one integer operand (var_n1) and writes the result to a workflow variable (ops_output).
var_n1 supports $workflow_variable references — resolved at runtime and parsed as an int before the operation is applied.
Supported operations
The arithmetic_ops field is an integer code that selects the operation to apply.
arithmetic_ops code |
Operation | Description |
|---|---|---|
1 |
INCREMENT | var_n1 + 1 |
2 |
DECREMENT | var_n1 - 1 |
3 |
NEGATE | -var_n1 |
4 |
ABS | Math.abs(var_n1) — absolute value |
Input parameters
| Parameter | Type | Required | Possible values | Android Compatibility | AndroMate Compatibility | Default |
|---|---|---|---|---|---|---|
var_n1 |
Integer | Yes | Any integer — supports $variable references |
Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | 0 |
arithmetic_ops |
Integer | Yes | 1 (INC), 2 (DEC), 3 (NEG), 4 (ABS) |
Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | — |
Output parameters
| Field | Type | Trigger condition | Android Compatibility | AndroMate Compatibility | Default |
|---|---|---|---|---|---|
ops_output |
Integer (as String) | Always — on successful operation | Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | <ANDROMATE_NULL_VALUE> |
Exceptions
| Code | Trigger |
|---|---|
ARITHMETIC-OPS-001 |
The arithmetic_ops code does not match any supported operation |
Execution flowchart
flowchart TD
Start([▶ IntegerSingleOps]) --> ResolveX[🔄 Resolve var_n1\nfrom workflow context]
ResolveX --> ValidateOps{arithmetic_ops code known?}
ValidateOps -->|No| E1[❌ ARITHMETIC-OPS-001\nUnknown operator]
ValidateOps -->|Yes| Switch{arithmetic_ops}
Switch -->|1: INC| IncrOp["var_n1 + 1"]
Switch -->|2: DEC| DecrOp["var_n1 - 1"]
Switch -->|3: NEG| NegOp["-var_n1"]
Switch -->|4: ABS| AbsOp["Math.abs(var_n1)"]
IncrOp --> WriteOutput[💾 Write result to ops_output]
DecrOp --> WriteOutput
NegOp --> WriteOutput
AbsOp --> WriteOutput
WriteOutput --> Success([✅ TaskIntegerResult])
E1 --> Error([❌ Exception])
style Start fill:#e3f2fd
style Success fill:#c8e6c9
style Error fill:#ffcdd2
style E1 fill:#ffcdd2
style ResolveX fill:#fff9c4
style IncrOp fill:#f3e5f5
style DecrOp fill:#f3e5f5
style NegOp fill:#f3e5f5
style AbsOp fill:#f3e5f5
style WriteOutput fill:#c8e6c9
How it works:
- Resolve operand:
var_n1is resolved from the workflow context and parsed as anint - Validate operator: if
arithmetic_opsis unknown, throwsARITHMETIC-OPS-001 - Execute operation: the corresponding arithmetic operation is applied
- Store result: the result is written to
ops_output - Result: returns
TaskIntegerResulton success
Code examples
Example 1 — Increment a counter
{
"IntegerSingleOps": [
{
"id": "1",
"title": "Increment counter",
"var_n1": "$counter",
"arithmetic_ops": 1,
"ops_output": "$counter"
}
]
}
Adds 1 to $counter and stores the result back in $counter.
Example 2 — Get absolute value
{
"IntegerSingleOps": [
{
"id": "2",
"title": "Absolute RTT",
"var_n1": "$delta_ms",
"arithmetic_ops": 4,
"ops_output": "$abs_delta"
}
]
}
Stores the absolute value of $delta_ms in $abs_delta.
Example 3 — Negate a value
{
"IntegerSingleOps": [
{
"id": "3",
"title": "Negate offset",
"var_n1": "$offset",
"arithmetic_ops": 3,
"ops_output": "$neg_offset"
}
]
}
Input parameter details
1. Input parameter: var_n1 — Operand
The integer value to operate on. Supports $workflow_variable references — resolved at runtime and parsed as an int.
- Default:
0 - Supports variables: Yes
2. Input parameter: arithmetic_ops — Operation code
Integer code selecting the unary operation to apply to var_n1.
| Code | Name | Operation |
|---|---|---|
1 |
INC | var_n1 + 1 |
2 |
DEC | var_n1 - 1 |
3 |
NEG | -var_n1 |
4 |
ABS | Math.abs(var_n1) |
- Default: — (required, no default — triggers
ARITHMETIC-OPS-001if unknown)
Output parameter details
ops_output — Operation result
Workflow variable name to store the integer result. Must be declared in the Start task.
| Operation | Value written |
|---|---|
| INC | var_n1 + 1 |
| DEC | var_n1 - 1 |
| NEG | -var_n1 |
| ABS | Math.abs(var_n1) |
- Default:
""(result not stored if empty)