CronExpression

org.llm4s.agent.service.CronExpression
See theCronExpression companion object
@Experimental
final class CronExpression

A five-field cron expression, minute hour day-of-month month day-of-week, for a scheduled run (#2446, decision 5 of docs/superpowers/specs/2026-11-22-scheduled-runs-design.md). Built by CronExpression.parse; compares, hashes and prints by its normalised text: the fields as written, upper-cased, one space apart.

'''Dialect.''' Each field is *, a number, a range a-b, a list a,b of numbers and ranges, or a step * + /n or a-b/n. Months (JAN-DEC) and days of the week (SUN-SAT) may be given by three-letter English names, in any case. Day of week is 0 to 7, 0 and 7 both Sunday. As in Vixie cron, when either day field starts with * a day must match both, and otherwise either: 0 0 13 * 5 fires on the 13th and on every Friday. There is no seconds or year field, no ?, L, W or #, and no @daily macros.

'''Time zones and DST.''' next reads the fields as local time in the zone it is given, by two rules:

  • when the hour field is * or * + /n, the schedule is an interval within the day and follows the timeline: a local time that does not exist does not fire, and one that happens twice fires both times;
  • otherwise the schedule names times of day, and each matching local time fires exactly once: one skipped by a transition fires at the instant of the transition (several skipped by one transition fire once, there), and one that happens twice fires at its first occurrence only. A real local time at the transition instant and the times skipped there fire as one: 0,30 2,3 * * * in America/New_York fires once at 03:00 on the day clocks go forward, then at 03:30.

Attributes

Companion
object
Source
CronExpression.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def equals(other: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
Any
Source
CronExpression.scala
override def hashCode: Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
Source
CronExpression.scala
def next(after: Instant, zone: ZoneId): Instant

The first fire time strictly after after, reading the fields in zone by the DST rules above.

The first fire time strictly after after, reading the fields in zone by the DST rules above.

Every expression parse accepts fires within 400 years of any instant (the Gregorian calendar repeats every 400 years, and parse refuses one that never fires), and the search stops there. An after within a thousand years of Instant.MAX gives Instant.MAX; one within a thousand years of Instant.MIN is read as that bound, as a local date-time cannot hold the years beyond it.

Attributes

Source
CronExpression.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
CronExpression.scala