Interface FunctionContext
Everything a function needs beyond its arguments arrives here, so that reading
ambient state is an explicit dependency rather than a static call into the
platform. The clock is the first member: NOW() reads it instead of
Instant.now(), which is what makes a whole run reproducible
when the engine pins one.
This is an interface rather than a record because it grows. A time zone, a
random source or a locale can be added as a default member without
breaking an implementation compiled against an earlier version.
-
Method Summary
Modifier and TypeMethodDescriptionclock()The clock the current-time functions read.static FunctionContextA context reading the given clock and nothing else.static FunctionContextof(Clock clock, Comparator<Value> valueOrder) A context reading the given clock and ranking values with the given order.static FunctionContextA context reading the system UTC clock — the default when nothing has pinned one, and the right choice in a test that does not observe time.default Comparator<Value> The engine's total order over values — whatsmallermeans to a reduction that has to pick one.
-
Method Details
-
clock
Clock clock()The clock the current-time functions read.- Returns:
- the clock for this evaluation; never
null
-
valueOrder
The engine's total order over values — whatsmallermeans to a reduction that has to pick one.An aggregate that ranks its input cannot invent an ordering: two libraries that each defined their own would disagree with the engine's sort and with each other, and the disagreement would show up as a
MINthat does not match the first row of aτ. The engine supplies one, and every implementation reads it from here.The default orders NULL last and compares like with like, which is what an implementation gets when nothing supplies a richer one. The engine's own order additionally reads an ISO-8601 string as the temporal value it spells, so a value that arrived as text from a schema-less source compares against a typed one.
- Returns:
- the comparator to rank values with; never
null
-
of
A context reading the given clock and nothing else.- Parameters:
clock- the clock current-time functions read- Returns:
- a context over
clock
-
of
A context reading the given clock and ranking values with the given order.- Parameters:
clock- the clock current-time functions readvalueOrder- the total order over values- Returns:
- a context over
clockandvalueOrder
-
systemDefault
A context reading the system UTC clock — the default when nothing has pinned one, and the right choice in a test that does not observe time.- Returns:
- a context over
Clock.systemUTC()
-