PtcRunner.Lisp.Runtime.Interop (PtcRunner v0.10.1)

Copy Markdown View Source

Simulated Java interop for PTC-Lisp.

Summary

Functions

Simulates System/currentTimeMillis.

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

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

Simulates .getTime method on java.util.Date.

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

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

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).

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).

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

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

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

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

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

Simulates java.time.LocalDate/parse. Only supports ISO-8601 YYYY-MM-DD.

Functions

current_time_millis()

Simulates System/currentTimeMillis.

dot_contains(s, substring)

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

dot_ends_with(s, suffix)

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

dot_get_time(dt)

Simulates .getTime method on java.util.Date.

dot_index_of(s, substring)

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(s, substring, from)

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

dot_is_after(a, b)

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(a, b)

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(s, substring)

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

dot_starts_with(s, prefix)

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

dot_to_lower_case(s)

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

dot_to_upper_case(s)

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

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(ts)

local_date_parse(s)

Simulates java.time.LocalDate/parse. Only supports ISO-8601 YYYY-MM-DD.