the set of timelines this is part of
Static
Readonly
BACKWARDSSymbolic constant for methods which take a 'direction' argument: refers to the start of the timeline, or backwards in time.
Static
Readonly
FORWARDSSymbolic constant for methods which take a 'direction' argument: refers to the end of the timeline, or forwards in time.
Add a new event to the timeline, and update the state
new event
addEvent options
Creates an independent timeline, inheriting the directional state from this timeline.
EventTimeline.BACKWARDS to get the state at the start of the timeline; EventTimeline.FORWARDS to get the state at the end of the timeline.
the new timeline
Forks the (live) timeline, taking ownership of the existing directional state of this timeline. All attached listeners will keep receiving state updates from the new live timeline state. The end state of this timeline gets replaced with an independent copy of the current RoomState, and will need a new pagination token if it ever needs to paginate forwards.
EventTimeline.BACKWARDS to get the state at the start of the timeline; EventTimeline.FORWARDS to get the state at the end of the timeline.
the new timeline
Get the base index.
This is an index which is incremented when events are prepended to the timeline. An individual event therefore stays at the same index in the array relative to the base index (although note that a given event's index may well be less than the base index, thus giving that event a negative relative index).
Get the list of events in this context
An array of MatrixEvents
Get the next timeline in the series
EventTimeline.BACKWARDS to get the previous timeline; EventTimeline.FORWARDS to get the next timeline.
previous or following timeline, if they have been joined up.
Get a pagination token
EventTimeline.BACKWARDS to get the pagination token for going backwards in time; EventTimeline.FORWARDS to get the pagination token for going forwards in time.
pagination token
Get the room state at the start/end of the timeline
EventTimeline.BACKWARDS to get the state at the start of the timeline; EventTimeline.FORWARDS to get the state at the end of the timeline.
state at the start/end of the timeline
Get the timelineSet for this timeline
timelineSet
Initialise the start and end state with the given events
This can only be called before any events are added.
list of state events to initialise the state with.
Internal
Insert a new event into the timeline, and update the state.
TEMPORARY: until we have recursive relations, we need this function to exist to allow us to insert events in timeline order, which is our best guess for Sync Order. This is a copy of addEvent above, modified to allow inserting an event at a specific index.
Remove an event from the timeline
ID of event to be removed
removed event, or null if not found
Set the next timeline in the series
previous/following timeline
EventTimeline.BACKWARDS to set the previous timeline; EventTimeline.FORWARDS to set the next timeline.
Set a pagination token
pagination token
EventTimeline.BACKWARDS to set the pagination token for going backwards in time; EventTimeline.FORWARDS to set the pagination token for going forwards in time.
Static
setStatic helper method to set sender and target properties
the event whose metadata is to be set
the room state to be queried
if true the event's forwardLooking flag is set false
Construct a new EventTimeline
An EventTimeline represents a contiguous sequence of events in a room.
As well as keeping track of the events themselves, it stores the state of the room at the beginning and end of the timeline, and pagination tokens for going backwards and forwards in the timeline.
In order that clients can meaningfully maintain an index into a timeline, the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is incremented when events are prepended to the timeline. The index of an event relative to baseIndex therefore remains constant.
Once a timeline joins up with its neighbour, they are linked together into a doubly-linked list.