Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,50 @@ dylib
xcode
Trendshift

UDF
UDFs
StringUtils
UpperCaseOdd
Comment on lines +689 to +692
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix alphabetical ordering of new wordlist entries.

The entries "UDF" and "UDFs" are correctly placed alphabetically after "Trendshift", but "StringUtils" is out of order. It should be inserted in the 'S' section (around line 281-288 where other "Str*" entries like "str", "strList", and "substring" are located), not at the end of the file.

🔎 Proposed fix for alphabetical ordering

Move "StringUtils" to its correct alphabetical position in the 'S' section:

  stopwords
  str
+ StringUtils
  strList
  subcommands

Then remove it from the end of the file:

  Trendshift

  UDF
  UDFs
- StringUtils
  UpperCaseOdd

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In .wordlist.txt around lines 689-692 the entries list includes "UDF", "UDFs",
and "StringUtils"; "UDF" and "UDFs" are fine but "StringUtils" is out of
alphabetical order and must be moved into the 'S' section; cut the "StringUtils"
entry from lines 689-692 and insert it into the 'S' block around lines 281-288
with other "Str*" entries (e.g., alongside "str", "strList", before "substring")
so the file remains alphabetically ordered, then save the file.

unparseable
toTimeZone
jaccard
Jaccard
levenshtein
submap
Submap
removeKeys
removeKey
fromPairs
fromJsonList
fromJsonMap
toJson
bitwise
Bitwise
Jaro
PascalCase
UpperCamelCase
Winkler
camelCase
decapitalize
indexOf
indexesOf
jaroWinkler
lpad
regexGroups
rpad
snakeCase
swapCase
Deduplicate
Deduplication
deduplication
sanitization
sprintf
fullMatch
abc
upperCamelCase
shiftLeft
shiftRight

DBaaS
GCP
VPC
Expand Down
59 changes: 59 additions & 0 deletions udfs/flex/bitwise/and.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# bitwise.and

## Description
Performs a bitwise AND operation on two integers. Each bit in the result is 1 only if the corresponding bits in both operands are 1.

## Syntax
```cypher
flex.bitwise.and(a, b)
```

## Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `a` | number (integer) | Yes | First operand |
| `b` | number (integer) | Yes | Second operand |

## Returns
**Type:** number (integer)

The result of the bitwise AND operation.

## Examples

### Example 1: Basic AND Operation
```cypher
RETURN flex.bitwise.and(12, 10) AS result
```

**Output:**
```
result
------
8
```
(Binary: 1100 AND 1010 = 1000 = 8)

### Example 2: Checking Permission Flags
```cypher
WITH 7 AS userPermissions // 0111 (read=1, write=2, execute=4)
WITH userPermissions, 2 AS writeFlag
RETURN flex.bitwise.and(userPermissions, writeFlag) > 0 AS hasWrite
```

### Example 3: Masking Bits
```cypher
MATCH (d:Device)
WITH d, flex.bitwise.and(d.flags, 15) AS lowerNibble
RETURN d.id, lowerNibble
```

## Notes
- Operates on 32-bit signed integers in JavaScript
- Both operands are converted to integers if needed
- Commonly used for flag checking and bit masking

## See Also
- [bitwise.or](./or.md) - Bitwise OR operation
- [bitwise.xor](./xor.md) - Bitwise XOR operation
- [bitwise.not](./not.md) - Bitwise NOT operation
72 changes: 72 additions & 0 deletions udfs/flex/bitwise/not.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# bitwise.not

## Description
Performs a bitwise NOT operation (one's complement) on an integer, inverting all bits.

## Syntax
```cypher
flex.bitwise.not(a)
```

## Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `a` | number (integer) | Yes | The operand to invert |

## Returns
**Type:** number (integer)

The result of the bitwise NOT operation (one's complement).

## Examples

### Example 1: Basic NOT Operation
```cypher
RETURN flex.bitwise.not(5) AS result
```

**Output:**
```
result
------
-6
```
(Binary: NOT 0101 = ...11111010 in 32-bit two's complement = -6)

### Example 2: Inverting All Bits
```cypher
RETURN flex.bitwise.not(0) AS result
```

**Output:**
```
result
------
-1
```
(All bits become 1 in two's complement = -1)

### Example 3: Double NOT Returns Original
```cypher
WITH 42 AS value
RETURN flex.bitwise.not(flex.bitwise.not(value)) AS restored
```

**Output:**
```
restored
--------
42
```

## Notes
- Operates on 32-bit signed integers in JavaScript
- Result uses two's complement representation
- NOT operation inverts all bits including sign bit
- Formula: `~n = -(n + 1)`
- Less commonly used than AND, OR, XOR in typical applications

## See Also
- [bitwise.and](./and.md) - Bitwise AND operation
- [bitwise.or](./or.md) - Bitwise OR operation
- [bitwise.xor](./xor.md) - Bitwise XOR operation
65 changes: 65 additions & 0 deletions udfs/flex/bitwise/or.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# bitwise.or

## Description
Performs a bitwise OR operation on two integers. Each bit in the result is 1 if at least one of the corresponding bits in the operands is 1.

## Syntax
```cypher
flex.bitwise.or(a, b)
```

## Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `a` | number (integer) | Yes | First operand |
| `b` | number (integer) | Yes | Second operand |

## Returns
**Type:** number (integer)

The result of the bitwise OR operation.

## Examples

### Example 1: Basic OR Operation
```cypher
RETURN flex.bitwise.or(12, 10) AS result
```

**Output:**
```
result
------
14
```
(Binary: 1100 OR 1010 = 1110 = 14)

### Example 2: Combining Permission Flags
```cypher
WITH 1 AS readFlag, 2 AS writeFlag
RETURN flex.bitwise.or(readFlag, writeFlag) AS readWritePermission
```

**Output:**
```
readWritePermission
-------------------
3
```
(Binary: 01 OR 10 = 11 = 3)

### Example 3: Setting Multiple Flags
```cypher
MATCH (u:User {id: 123})
SET u.permissions = flex.bitwise.or(u.permissions, 4) // Add execute permission
```

## Notes
- Operates on 32-bit signed integers in JavaScript
- Both operands are converted to integers if needed
- Commonly used for combining flags and setting bits

## See Also
- [bitwise.and](./and.md) - Bitwise AND operation
- [bitwise.xor](./xor.md) - Bitwise XOR operation
- [bitwise.not](./not.md) - Bitwise NOT operation
77 changes: 77 additions & 0 deletions udfs/flex/bitwise/shiftLeft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# bitwise.shiftLeft

## Description
Performs a left bit shift operation, moving all bits to the left by the specified number of positions. Zero bits are shifted in from the right.

## Syntax
```cypher
flex.bitwise.shiftLeft(a, positions)
```

## Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `a` | number (integer) | Yes | The value to shift |
| `positions` | number (integer) | Yes | Number of positions to shift left |

## Returns
**Type:** number (integer)

The result of shifting the bits left by the specified positions.

## Examples

### Example 1: Basic Left Shift
```cypher
RETURN flex.bitwise.shiftLeft(5, 2) AS result
```

**Output:**
```
result
------
20
```
(Binary: 0101 << 2 = 10100 = 20)

### Example 2: Multiply by Power of Two
```cypher
WITH 7 AS value
RETURN
flex.bitwise.shiftLeft(value, 1) AS times2,
flex.bitwise.shiftLeft(value, 2) AS times4,
flex.bitwise.shiftLeft(value, 3) AS times8
```

**Output:**
```
times2 | times4 | times8
-------|--------|-------
14 | 28 | 56
```
(Left shift by n is equivalent to multiplying by 2^n)

### Example 3: Creating Bit Masks
```cypher
RETURN flex.bitwise.shiftLeft(1, 3) AS mask
```

**Output:**
```
mask
----
8
```
(Creates mask with bit 3 set: 1000)

## Notes
- Operates on 32-bit signed integers in JavaScript
- Left shift by n is equivalent to multiplying by 2^n
- Bits shifted off the left are discarded
- Zero bits are shifted in from the right
- Useful for multiplication by powers of 2 and creating bit masks

## See Also
- [bitwise.shiftRight](./shiftRight.md) - Shift bits to the right
- [bitwise.and](./and.md) - Bitwise AND operation
- [bitwise.or](./or.md) - Bitwise OR operation
Loading