# `PtcRunner.Lisp.Runtime.Interop`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/lisp/runtime/interop.ex#L1)

Simulated Java interop for PTC-Lisp.

# `boolean_parse_boolean`

Simulates java.lang.Boolean.parseBoolean(String).

# `current_time_millis`

Simulates System/currentTimeMillis.

# `dot_contains`

Simulates .contains method on strings.
Delegates to `String.contains?/2`.

# `dot_ends_with`

Simulates .endsWith method on strings.
Delegates to `String.ends_with?/2`.

# `dot_get_time`

Simulates .getTime method on java.util.Date.

# `dot_index_of`

Simulates .indexOf method on strings.
Returns the grapheme index of the first occurrence of substring, or -1 if not found.

Delegates to `Runtime.String.index_of/2` and converts `nil` to `-1` for Java semantics.
Uses grapheme indices (not byte offsets) for compatibility with `subs` and other
PTC-Lisp string functions.

# `dot_index_of`

Simulates .indexOf method on strings with a starting position.
Delegates to `Runtime.String.index_of/3` and converts `nil` to `-1`.

# `dot_is_after`

Simulates .isAfter method on Date and DateTime objects.
Returns true if the first argument comes strictly after the second.
Both arguments must be the same type (Date/Date or DateTime/DateTime).

# `dot_is_before`

Simulates .isBefore method on Date and DateTime objects.
Returns true if the first argument comes strictly before the second.
Both arguments must be the same type (Date/Date or DateTime/DateTime).

# `dot_last_index_of`

Simulates .lastIndexOf method on strings.
Delegates to `Runtime.String.last_index_of/2` and converts `nil` to `-1`.

# `dot_length`

Simulates .length method on strings.
Returns grapheme count (matches Java's `length()` for the BMP and the
PTC-Lisp `count` builtin). Delegates to `String.length/1`.

# `dot_minus_days`

# `dot_plus_days`

# `dot_starts_with`

Simulates .startsWith method on strings.
Delegates to `String.starts_with?/2`.

# `dot_substring`

Simulates .substring method on strings.

- `(.substring s start)` returns the suffix from grapheme index `start`.
- `(.substring s start end)` returns graphemes in `[start, end)`.

Indices are grapheme-based (matches `.indexOf` / `.length` semantics).

`.substring` is a Java-shaped method, so finite numeric indexes are coerced to
the Java `int` parameter by truncating toward zero — `(.substring "abcd" 1.0)`
and `(.substring "abcd" 1.9)` both behave like `1`. Non-finite floats (NaN,
Infinity) are PTC-Lisp signal atoms rather than `is_float` values, so they fall
through to the type-error clauses below.

# `dot_substring`

# `dot_to_days`

# `dot_to_epoch_day`

# `dot_to_lower_case`

Simulates .toLowerCase method on strings.
Delegates to `String.downcase/1`.

# `dot_to_millis`

# `dot_to_upper_case`

Simulates .toUpperCase method on strings.
Delegates to `String.upcase/1`.

# `duration_between`

# `java_util_date`

Constructs a java.util.Date.
If no args, returns now.
If one arg (number or string), returns date accordingly.

# `java_util_date`

# `parse_temporal`

Parse an ISO-8601 temporal string. Backs the `parse` builtin (also
reachable as `LocalDate/parse`).

Dispatches on the string shape:

- `"YYYY-MM-DD"` → `Date`
- a string carrying a time component (`...T...`) → `DateTime`. An offset
  (`Z`, `+02:00`, …) is honoured; an offsetless `...T...` value is treated
  as UTC. `.isBefore` / `.isAfter` / `.getTime` work on the result.

This is a deliberate divergence from Java's `LocalDate.parse`, which
rejects anything with a time component — returning a `DateTime` is far more
useful for an LLM that just wants to compare two timestamps.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
