Options
All
  • Public
  • Public/Protected
  • All
Menu

A class that can modify the events of a schedule by storing Identifiers and an associated value.

Type parameters

  • T

    The type of data that modifies the schedule.

Hierarchy

  • ScheduleModifier

Index

Constructors

constructor

Properties

map

map: object

The map of values mapped by their Identifiers.

Type declaration

  • [id: string]: T

Methods

clear

  • clear(): this

describe

  • describe(short?: boolean): Iter<string, T>
  • Builds a list of the descriptions of the identifiers in this modifier.

    Parameters

    • Default value short: boolean = false

      If the description should use shorter language or longer.

    Returns Iter<string, T>

    The built list of descriptions.

describeMap

  • Builds a map of the values/modifications keyed by the descripton of the identifier computed via Identifier.describe.

    Parameters

    • Default value short: boolean = false

      If the description should use shorter language or longer.

    Returns ScheduleModifierDescription<T>

    The built map of description to values/modifications.

get

  • get(day: Day, otherwise: T, lookAtTime?: boolean): T
  • Gets the most specific value in this modifier for the given day, if none exists otherwise is returned. A modifier can have multiple values for a given day because Identifiers represent a span of time.

    Parameters

    • day: Day

      The day to get a value for.

    • otherwise: T

      What to return if no value exists for the given day.

    • Default value lookAtTime: boolean = true

      If the specific time of the given day should be looked at.

    Returns T

    The most specific value for the given day, or otherwise.

getAll

  • getAll(day: Day): T[]
  • Gets all values in this modifier for the given day. If none exist, an empty array is returned. The values returned in the array are returned in most specific to least specific.

    Parameters

    • day: Day

      The day to get the values for.

    Returns T[]

    An array of values (modifications) for the given day.

getIdentifier

  • Gets the most specific identifier type for the span over the given day. If the day does not have a modification, null is returned.

    Parameters

    • day: Day

      The day to get the type for.

    • Default value lookAtTime: boolean = true

      If the specific time of the given day should be looked at.

    Returns Identifier

    The most specific identifier for the given day, otherwise null.

identifiers

isEmpty

  • isEmpty(): boolean
  • Returns true if this modifier lacks any modifications, otherwise false.

    Returns boolean

iterate

move

  • Moves the value/modification from one identifier to another.

    Parameters

    • from: Day

      The day to take the identifier from.

    • fromType: Identifier

      The identifier type.

    • to: Day

      The day to move the value to.

    • toType: Identifier

      The identifier type to move the value to.

    Returns this

moveTime

  • moveTime(fromTime: Time, toTime: Time): number
  • Moves any identifiers with the matching time fromTime to toTime and returns the number of moves.

    Parameters

    • fromTime: Time

      The time to move from.

    • toTime: Time

      The time to move to.

    Returns number

    The number of modifiers moved.

query

  • Queries the modifier for all values/modifications which fall in the time span that the given identifier represents. All identifiers and their value are passed to the given callback.

    Parameters

    Returns Iter<[IdentifierInput, T], T>

    A new instance of an [[Iterator]].

removeTime

  • removeTime(time: Time): number
  • Removes any identifiers and modifications that are at the given time.

    Parameters

    • time: Time

      The time to remove.

    Returns number

    The number of modifiers removed.

set

  • Sets the value/modification in this map given a day, the value, and the identifier type.

    Parameters

    • day: Day

      The day to take an identifier from.

    • value: T

      The value/modification to set.

    • type: Identifier

      The identifier type.

    Returns this

spans

  • Builds a list of spans and the associated values. The spans are calculated from the identifier key via Identifier.span.

    Parameters

    • Default value endInclusive: boolean = false

      If the end date in the spans should be the last millisecond of the timespan or the first millisecond of the next.

    Returns Iter<ScheduleModifierSpan<T>, T>

    An array of spans calculated from the identifiers with the associated values/modifications.

unset

  • Removes the value/modification from this modifier based on the identifier pulled from the day.

    Parameters

    • day: Day

      The day to take an identifier from.

    • type: Identifier

      The identifier type.

    Returns this

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc