TimeNum

scalation.TimeNum
See theTimeNum companion object
class TimeNum(val inst: Instant) extends Numeric[TimeNum], Ordered[TimeNum], Serializable

The TimeNum class is used to represent and operate on date-time numbers. Internally, a date-time number is represented as an Instant.

Value parameters

inst

the underlying Instant of time

Attributes

Companion
object
Graph
Supertypes
trait Ordered[TimeNum]
trait Comparable[TimeNum]
trait Numeric[TimeNum]
trait Ordering[TimeNum]
trait PartialOrdering[TimeNum]
trait Equiv[TimeNum]
trait Serializable
trait Comparator[TimeNum]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited classlikes

class NumericOps(lhs: Numeric.this.T)

Attributes

Inherited from:
Numeric
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Fractional.this.FractionalOps
class OrderingOps(lhs: Ordering.this.T)

This inner class defines comparison operators available for T.

This inner class defines comparison operators available for T.

It can't extend AnyVal because it is not a top-level class or a member of a statically accessible object.

Attributes

Inherited from:
Ordering
Supertypes
class Object
trait Matchable
class Any

Value members

Constructors

def this(dt: ZonedDateTime)

Construct a TimeNum object from the given date-time by taking a ZonedDateTime and converting it to the corresponding Instant, the underlying type of TimeNum class.

Construct a TimeNum object from the given date-time by taking a ZonedDateTime and converting it to the corresponding Instant, the underlying type of TimeNum class.

Value parameters

dt

the given date-time

Attributes

def this(dt: String, dtPattern: String = ...)

Construct a TimeNum object from the given date-time by creating a ZonedDateTime from the string and converting it to the corresponding Instant, the underlying type of TimeNum class. Format it using dtPattern.

Construct a TimeNum object from the given date-time by creating a ZonedDateTime from the string and converting it to the corresponding Instant, the underlying type of TimeNum class. Format it using dtPattern.

Value parameters

dt

the given date-time as a string

dtPattern

the given date-time pattern/format

Attributes

Concrete methods

def !=~(t: TimeNum): Boolean

Return whether two TimeNum numbers not are nearly equal.

Return whether two TimeNum numbers not are nearly equal.

Value parameters

t

compare this with t

Attributes

inline def *(t: TimeNum): TimeNum
inline def *(tl: Long): TimeNum
inline def +(t: TimeNum): TimeNum
inline def +(tl: Long): TimeNum
inline def -(t: TimeNum): TimeNum
inline def -(tl: Long): TimeNum
inline def /(t: TimeNum): TimeNum
def =~(t: TimeNum): Boolean

Return whether two TimeNum numbers are nearly equal.

Return whether two TimeNum numbers are nearly equal.

Value parameters

t

the TimeNum to compare with this

Attributes

infix def compare(t: TimeNum): Int

Compare two TimeNum numbers (negative for <, zero for ==, positive for >).

Compare two TimeNum numbers (negative for <, zero for ==, positive for >).

Value parameters

t

the TimeNum number to compare with this

Attributes

def compare(s: TimeNum, t: TimeNum): Int

Compare two TimeNum numbers (negative for <, zero for ==, positive for >).

Compare two TimeNum numbers (negative for <, zero for ==, positive for >).

Value parameters

s

the first TimeNum number

t

the second TimeNum number

Attributes

def divide(s: TimeNum, t: TimeNum): TimeNum

Divide this TimeNum by TimeNum t.

Divide this TimeNum by TimeNum t.

Value parameters

t

the TimeNum that divides this

Attributes

infix override def equals(t: Any): Boolean

Override equals to determine whether this date-time number equals date-time t.

Override equals to determine whether this date-time number equals date-time t.

Value parameters

t

the date-time number to compare with this

Attributes

Definition Classes
Comparator -> Any
def fromDouble(d: Double): TimeNum
def fromInt(i: Int): TimeNum
def getChrono(chrono: ChronoField, zone: ZoneId = ...): Long

Get a temporal aspect (e.g., month, week, day, hour, ...).

Get a temporal aspect (e.g., month, week, day, hour, ...).

Value parameters

chrono

the enumeration type specifying the aspect to return

Attributes

See also

https://docs.oracle.com/en/java/javase/17/docs/api//java.base/java/time/ZonedDateTime.html Currently only four (INSTANT_SECONDS, MICRO_OF_SECOND, MILLI_OF_SECOND, NANO_OF_SECOND) of the enumeration values are implemented, but ScalaTion adds seven more (see below).

override def hashCode: Int

Must also override hashCode to be compatible with equals.

Must also override hashCode to be compatible with equals.

Attributes

Definition Classes
Any
infix def in(lim: (TimeNum, TimeNum)): Boolean

Determine whether this is within the given bounds.

Determine whether this is within the given bounds.

Value parameters

lim

the given (lower, upper) bounds

Attributes

infix def in(set: Set[TimeNum]): Boolean

Determine whether this is in the given set.

Determine whether this is in the given set.

Value parameters

lim

the given set of values

Attributes

def max(t: TimeNum): TimeNum

Return the maximum of this and t TimeNum numbers.

Return the maximum of this and t TimeNum numbers.

Value parameters

t

the TimeNum number to compare with this

Attributes

def min(t: TimeNum): TimeNum

Return the minimum of this and t TimeNum numbers.

Return the minimum of this and t TimeNum numbers.

Value parameters

t

the TimeNum number to compare with this

Attributes

def minus(s: TimeNum, t: TimeNum): TimeNum

Subtract TimeNumt from thisTimeNum`.

Subtract TimeNumt from thisTimeNum`.

Value parameters

t

the TimeNum to subtract from this

Attributes

Compute the unary minus (-).

Compute the unary minus (-).

Attributes

infix def not_in(set: Set[TimeNum]): Boolean

Determine whether this is not in the given set.

Determine whether this is not in the given set.

Value parameters

lim

the given set of values

Attributes

infix def out(lim: (TimeNum, TimeNum)): Boolean

Determine whether this is outside the given bounds.

Determine whether this is outside the given bounds.

Value parameters

lim

the given (lower, upper) bounds

Attributes

def parseString(str: String): Option[TimeNum]

Parse the string to create a time number.

Parse the string to create a time number.

Attributes

def plus(s: TimeNum, t: TimeNum): TimeNum

Add this TimeNum and TimeNum t. The seconds and nanoseconds are added separately, with carry from nanoseconds handled.

Add this TimeNum and TimeNum t. The seconds and nanoseconds are added separately, with carry from nanoseconds handled.

Value parameters

t

the TimeNum to add to this

Attributes

def times(s: TimeNum, t: TimeNum): TimeNum

Multiply this TimeNum and TimeNum t.

Multiply this TimeNum and TimeNum t.

Value parameters

t

the TimeNum that multiplies this

Attributes

def toDouble(t: TimeNum): Double

Convert the given TimeNum number to a Double.

Convert the given TimeNum number to a Double.

Value parameters

t

that date-time number to convert

Attributes

def toDouble: Double
def toFloat(t: TimeNum): Float

Convert this TimeNum number to a Float.

Convert this TimeNum number to a Float.

Value parameters

t

that date-time number to convert

Attributes

def toFloat: Float
def toInt(t: TimeNum): Int

Convert this TimeNum number to an Int.

Convert this TimeNum number to an Int.

Value parameters

t

that date-time number to convert

Attributes

def toInt: Int
def toLong(t: TimeNum): Long

Convert this TimeNum number to a Long.

Convert this TimeNum number to a Long.

Value parameters

t

that date-time number to convert

Attributes

def toLong: Long
override def toString: String

Convert this date-time number to a String.

Convert this date-time number to a String.

Attributes

Definition Classes
Any
def toString2(format: String = ...): String

Convert this date time number to a String in the format specified by the user, use DEFAULT_DATETIME_FORMAT if user does not specify any format.

Convert this date time number to a String in the format specified by the user, use DEFAULT_DATETIME_FORMAT if user does not specify any format.

Value parameters

format

the format to be used

Attributes

Convert this date-time number to a TimeNum.

Convert this date-time number to a TimeNum.

Attributes

inline def unary_-: TimeNum
def ~^(t: TimeNum): TimeNum

Raise this TimeNum to power TimeNum t.

Raise this TimeNum to power TimeNum t.

Value parameters

t

the TimeNum that raises this

Attributes

inline def (t: TimeNum): TimeNum
inline def (lim: (TimeNum, TimeNum)): Boolean
inline def (set: Set[TimeNum]): Boolean
inline def (lim: (TimeNum, TimeNum)): Boolean
inline def (set: Set[TimeNum]): Boolean
inline def (t: TimeNum): Boolean
inline def (t: TimeNum): Boolean
inline def (t: TimeNum): Boolean

Compare this TimeNum number with that date-time number t for inequality.

Compare this TimeNum number with that date-time number t for inequality.

Value parameters

t

that TimeNum number

Attributes

inline def (t: TimeNum): Boolean

Compare this TimeNum number with that date-time number t for less than or equal to.

Compare this TimeNum number with that date-time number t for less than or equal to.

Value parameters

t

that TimeNum number

Attributes

inline def (t: TimeNum): Boolean

Compare this TimeNum number with that date-time number t for greater than or equal to.

Compare this TimeNum number with that date-time number t for greater than or equal to.

Value parameters

t

that TimeNum number

Attributes

Inherited methods

def <(that: TimeNum): Boolean

Returns true if this is less than that

Returns true if this is less than that

Attributes

Inherited from:
Ordered
def <=(that: TimeNum): Boolean

Returns true if this is less than or equal to that.

Returns true if this is less than or equal to that.

Attributes

Inherited from:
Ordered
def >(that: TimeNum): Boolean

Returns true if this is greater than that.

Returns true if this is greater than that.

Attributes

Inherited from:
Ordered
def >=(that: TimeNum): Boolean

Returns true if this is greater than or equal to that.

Returns true if this is greater than or equal to that.

Attributes

Inherited from:
Ordered
def abs(x: TimeNum): TimeNum

Attributes

Inherited from:
Numeric
def compareTo(that: TimeNum): Int

Result of comparing this with operand that.

Result of comparing this with operand that.

Attributes

Inherited from:
Ordered
override def equiv(x: TimeNum, y: TimeNum): Boolean

Returns true if x == y in the ordering.

Returns true if x == y in the ordering.

Attributes

Definition Classes
Ordering -> PartialOrdering -> Equiv
Inherited from:
Ordering
override def gt(x: TimeNum, y: TimeNum): Boolean

Returns true if x > y in the ordering.

Returns true if x > y in the ordering.

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
override def gteq(x: TimeNum, y: TimeNum): Boolean

Returns true if x >= y in the ordering.

Returns true if x >= y in the ordering.

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def isReverseOf(other: Ordering[_]): Boolean

Returns whether or not the other ordering is the opposite ordering of this one.

Returns whether or not the other ordering is the opposite ordering of this one.

Equivalent to other == this.reverse.

Implementations should only override this method if they are overriding reverse as well.

Attributes

Inherited from:
Ordering
override def lt(x: TimeNum, y: TimeNum): Boolean

Returns true if x < y in the ordering.

Returns true if x < y in the ordering.

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
override def lteq(x: TimeNum, y: TimeNum): Boolean

Returns true if x <= y in the ordering.

Returns true if x <= y in the ordering.

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def max[U <: TimeNum](x: U, y: U): U

Returns x if x >= y, otherwise y.

Returns x if x >= y, otherwise y.

Attributes

Inherited from:
Ordering
def min[U <: TimeNum](x: U, y: U): U

Returns x if x <= y, otherwise y.

Returns x if x <= y, otherwise y.

Attributes

Inherited from:
Ordering
def on[U](f: U => TimeNum): Ordering[U]

Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:

Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:

def compare(x:U, y:U) = Ordering[T].compare(f(x), f(y))

Attributes

Inherited from:
Ordering
def one: TimeNum

Attributes

Inherited from:
Numeric
def orElse(other: Ordering[TimeNum]): Ordering[TimeNum]

Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.

Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.

Value parameters

other

an Ordering to use if this Ordering returns zero

Attributes

Example
case class Pair(a: Int, b: Int)
val pairOrdering = Ordering.by[Pair, Int](_.a)
                          .orElse(Ordering.by[Pair, Int](_.b))
Inherited from:
Ordering
def orElseBy[S](f: TimeNum => S)(implicit ord: Ordering[S]): Ordering[TimeNum]

Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:

Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:

Ordering[S].compare(f(x), f(y))

This function is equivalent to passing the result of Ordering.by(f) to orElse.

Attributes

Example
case class Pair(a: Int, b: Int)
val pairOrdering = Ordering.by[Pair, Int](_.a)
                          .orElseBy[Int](_.b)
Inherited from:
Ordering
override def reverse: Ordering[TimeNum]

Returns the opposite ordering of this one.

Returns the opposite ordering of this one.

Implementations overriding this method MUST override isReverseOf as well if they change the behavior at all (for example, caching does not require overriding it).

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def reversed(): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def sign(x: TimeNum): TimeNum

Attributes

Inherited from:
Numeric
def thenComparing[U <: Comparable[_ >: U <: <FromJavaObject>]](x$0: Function[_ >: TimeNum <: <FromJavaObject>, _ <: U]): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def thenComparing[U <: <FromJavaObject>](x$0: Function[_ >: TimeNum <: <FromJavaObject>, _ <: U], x$1: Comparator[_ >: U <: <FromJavaObject>]): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def thenComparing(x$0: Comparator[_ >: TimeNum <: <FromJavaObject>]): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def thenComparingDouble(x$0: ToDoubleFunction[_ >: TimeNum <: <FromJavaObject>]): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def thenComparingInt(x$0: ToIntFunction[_ >: TimeNum <: <FromJavaObject>]): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def thenComparingLong(x$0: ToLongFunction[_ >: TimeNum <: <FromJavaObject>]): Comparator[TimeNum]

Attributes

Inherited from:
Comparator
def tryCompare(x: TimeNum, y: TimeNum): Some[Int]

Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).

Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).

Attributes

Inherited from:
Ordering
def zero: TimeNum

Attributes

Inherited from:
Numeric

Deprecated and Inherited methods

def signum(x: TimeNum): Int

Attributes

Deprecated
[Since version 2.13.0] use `sign` method instead
Inherited from:
Numeric

Concrete fields

val inst: Instant

Implicits

Inherited implicits

implicit def mkNumericOps(lhs: TimeNum): NumericOps

Attributes

Inherited from:
Numeric
implicit def mkOrderingOps(lhs: TimeNum): OrderingOps

This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.

This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.

Attributes

Inherited from:
Ordering