Interface TimelineEntry

All Superinterfaces:
Comparable<TimelineEntry>
All Known Subinterfaces:
CustomTimelineItem
All Known Implementing Classes:
CustomTimelineEntry, CustomTimelineLabel, TextFileLabelEntry, TextFileTimelineEntry, TranslatedTextFileEntry

public interface TimelineEntry extends Comparable<TimelineEntry>
Base interface for a timeline entry
  • Method Details

    • getMinTime

      default double getMinTime()
      Returns:
      The earliest possible sync time
    • getMaxTime

      default double getMaxTime()
      Returns:
      The latest possible sync time
    • shouldSync

      default boolean shouldSync(double currentTime, String line)
      Determine whether the timeline should be synced to this entry given the current time and a line
      Parameters:
      currentTime - The time at which the timeline currently sits
      line - The incoming log line
      Returns:
      Whether the timeline should sync
    • eventSyncController

      @Nullable @Nullable EventSyncController eventSyncController()
    • hasEventSync

      default boolean hasEventSync()
    • eventSyncType

      @Nullable default @Nullable Class<? extends Event> eventSyncType()
    • shouldSync

      default boolean shouldSync(double currentTime, Event event)
    • canSync

      default boolean canSync()
      Returns:
      true if this timeline entry would ever cause a sync
    • getSyncToTime

      default Double getSyncToTime(LabelResolver resolver)
      Returns:
      The time to sync to, or null in the case of a resolution error (error should be logged elsewhere)
    • toString

      @Nullable @Nullable String toString()
      Overrides:
      toString in class Object
    • time

      double time()
      The time of this timeline entry
      Returns:
      The timeline entry's time
    • name

      @Nullable @Nullable String name()
      The name of this timeline entry.

      For most entries, this is the displayed name. For labels, it is the label name. For triggers, it is the text that will be displayed on-screen.

      Returns:
      The name
    • sync

      @Nullable @Nullable Pattern sync()
      ACT parsed line regex to sync to
      Returns:
      The sync pattern
    • duration

      @Nullable @Nullable Double duration()
      An optional duration for the bar to be in "active" state as opposed to immediately becoming "in the past" when its time arrives.
      Returns:
      The optional duration
    • timelineWindow

      @NotNull @NotNull TimelineWindow timelineWindow()
      The relative window in which this entry can be synced to
      Returns:
      The sync window
    • jump

      @Nullable @Nullable Double jump()
      An optional time to jump to. If forceJump() is false, this line must have its sync conditions hit (i.e. we are syncing onto this line). If forceJump is true, then the jump will also happen if this timeline entry's time is hit.
      Returns:
      The jump time.
      See Also:
    • jumpLabel

      @Nullable @Nullable String jumpLabel()
      Same as jump(), but takes a 'label' to jump to instead of a raw time.
      Returns:
      The jump label
      See Also:
    • forceJump

      default boolean forceJump()
      Affects the behavior of jump() and jumpLabel(). If true, then the jump will occur unconditionally when the current timeline time hits the time of this entry (i.e. when we are T-0 from hitting this entry). If false, jumps will only occur when this entry is synced to.
      Returns:
      whether to force jumps even without a sync
      See Also:
    • isLabel

      default boolean isLabel()
      Returns:
      true if this entry is a label
    • enabled

      boolean enabled()
      Returns:
      Whether this entry is enabled
    • compareTo

      default int compareTo(@NotNull @NotNull TimelineEntry o)
      Compare the times of this timeline entry vs another entry
      Specified by:
      compareTo in interface Comparable<TimelineEntry>
      Parameters:
      o - the timeline entry to which we are comparing
      Returns:
      The same as Double.compare(this.time(), o.time())
    • icon

      @Nullable default @Nullable URL icon()
      Returns:
      An optional icon to display for the entry on the timeline bar and trigger (if it has one)
    • replaces

      @Nullable default @Nullable TimelineReference replaces()
      Returns:
      If this entry overrides another entry, return a reference to the entry it overrides. Otherwise, return null.
      See Also:
    • shouldSupersede

      default boolean shouldSupersede(TimelineEntry that)
      Determine if another timeline entry should be replaced by this one. Always returns null if replaces() is null.
      Parameters:
      that - The entry to check if we are replacing.
      Returns:
      true if it should be superseded/replaced by this entry, false otherwise.
    • callout

      boolean callout()
      Returns:
      True if this entry is also a timeline trigger.
    • calloutPreTime

      double calloutPreTime()
      Returns:
      The amount of time before this entry's time() that the trigger should fire
    • effectiveCalloutTime

      default double effectiveCalloutTime()
      Returns:
      The effective time at which the trigger would fire
    • enabledForJob

      default boolean enabledForJob(Job job)
      Whether the entry is enabled for a certain job
      Parameters:
      job - The job
      Returns:
      true if enabled for that job
    • untranslated

      default TimelineEntry untranslated()
      The untranslated version of this entry.
      Returns:
      The untranslated version. Returns 'this' if it is already untranslated.
    • toTextFormat

      default String toTextFormat()
      Returns:
      This entry, ported back to Cactbot format.
    • makeTriggerTimelineEntries

      default Stream<String> makeTriggerTimelineEntries()
      Returns:
      Any extra Cactbot-format timeline entries needed to make this work as a trigger. Does not include the actual user-js trigger, only the timeline entries that will be necessary for it.
    • getAllTextEntries

      default Stream<String> getAllTextEntries()
      Returns:
      A stream consisting of toTextFormat() and makeTriggerTimelineEntries()
    • makeTriggerJs

      @Nullable default @Nullable String makeTriggerJs()
      Returns:
      The Cactbot user-js needed to make this timeline trigger work. If this is not a trigger, return null;
    • getImportSource

      @Nullable default @Nullable String getImportSource()
    • isImported

      default boolean isImported()