DefaultTrigger

com.github.eikek.calev.internal.DefaultTrigger
object DefaultTrigger extends Trigger

Generate the next date-time that matches a calendar event and is closest but after a give reference date-time.

This is done as follows: The reference date is divided into its components, like day, month, year, hour, minute and second. For each component, starting from the least significant one, a value matching the corresponding calendar event component is chosen. For example, if the reference minute is 16 and the minute component is 0/10, the closest possible value is 20.

There are three possible outcomes for each decision (stop after first result):

  1. the current value matches as is 2. there is one greater than the current value 3. use the first possible value (which is lower than current)

If the result is 1) go to the next component. If the result is 2) the date has moved into the future. Then all previous results must be set to the first possible value, in order to get the closest date. If the result is 3) the next component may only check for 2) and 3). If the result 3) carries through to the year component, the year must be set to the next value. If that is not possible, there is no date-time and a `None' is returned.

Attributes

Graph
Supertypes
trait Trigger
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class Calc(flag: Flag, date: DateTime, pos: Pos, ce: CalEvent)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Calc

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Calc.type
case class Date(year: Int, month: Int, day: Int)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Date

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Date.type
case class DateTime(date: Date, time: Time)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object DateTime

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
DateTime.type
object Flag

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Flag.type
sealed trait Flag

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Exact
object First
object Next
case class Time(hour: Int, minute: Int, second: Int)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Time

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Time.type

Value members

Concrete methods

def next(ref: ZonedDateTime, ev: CalEvent): Option[ZonedDateTime]

Inherited methods

def nextRepeat(count: Int)(ref: ZonedDateTime, ev: CalEvent): List[ZonedDateTime]

Attributes

Inherited from:
Trigger