Moment

o1.time.Moment
class Moment(time: Int)

Each instance of the class Moment represents a “moment” on a timescale, identified by an integer number.

Different timescales may be used in different contexts. Moment objects could be used to represent different years, months, dates, hours, etc., depending on what is desired.

A Moment object is immutable after it has been created. That is, its state can not be changed in any way.

Parameters

time

an integer indicating which moment the object should represent (2024, for instance)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def distance(another: Moment): Int

Determines the length of time between this moment and another given moment. For instance, if this moment represents the year 2000 and another the year 2024, returns 24. The distance is always either positive or zero.

Determines the length of time between this moment and another given moment. For instance, if this moment represents the year 2000 and another the year 2024, returns 24. The distance is always either positive or zero.

Attributes

def earlier(another: Moment): Moment

Returns the earlier of two moments, either this one or the moment provided as a parameter. If there is no difference, one of the two is returned arbitrarily.

Returns the earlier of two moments, either this one or the moment provided as a parameter. If there is no difference, one of the two is returned arbitrarily.

Attributes

def isIn(interval: Interval): Boolean

Determines whether this moment is in the given time interval, that is, whether the given time interval contains this moment. A time interval is inclusive; its start and end moments are also contained in the interval.

Determines whether this moment is in the given time interval, that is, whether the given time interval contains this moment. A time interval is inclusive; its start and end moments are also contained in the interval.

Attributes

def isLaterThan(another: Moment): Boolean

Determines whether this moment is later than another given moment.

Determines whether this moment is later than another given moment.

Attributes

def isLaterThan(interval: Interval): Boolean

Determines whether this moment is later than the given time interval. This is only deemed to be the case if the entire interval comes before this moment on the timescale.

Determines whether this moment is later than the given time interval. This is only deemed to be the case if the entire interval comes before this moment on the timescale.

Attributes

def later(another: Moment): Moment

Returns the later of two moments, either this one or the moment provided as a parameter. If there is no difference, one of the two is returned arbitrarily.

Returns the later of two moments, either this one or the moment provided as a parameter. If there is no difference, one of the two is returned arbitrarily.

Attributes

override def toString: String

Produces a string representation of this moment. (It consists of just the digits.)

Produces a string representation of this moment. (It consists of just the digits.)

Attributes

Definition Classes
Any