2020-07-23 06:37:37 +00:00
|
|
|
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
class State {
|
2020-08-13 09:14:29 +00:00
|
|
|
#timeSelection = { start: 0, end: Infinity };
|
2020-07-28 12:46:10 +00:00
|
|
|
#map;
|
|
|
|
#ic;
|
2020-08-13 09:14:29 +00:00
|
|
|
#selectedMapLogEvents;
|
|
|
|
#selectedIcLogEvents;
|
2020-08-28 14:41:56 +00:00
|
|
|
#selectedSourcePositionLogEvents;
|
2020-08-04 08:51:59 +00:00
|
|
|
#nofChunks;
|
|
|
|
#chunks;
|
|
|
|
#icTimeline;
|
|
|
|
#mapTimeline;
|
2020-08-04 13:51:20 +00:00
|
|
|
#minStartTime = Number.POSITIVE_INFINITY;
|
|
|
|
#maxEndTime = Number.NEGATIVE_INFINITY;
|
2020-08-13 09:14:29 +00:00
|
|
|
get minStartTime() {
|
2020-08-04 13:51:20 +00:00
|
|
|
return this.#minStartTime;
|
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
get maxEndTime() {
|
2020-08-04 13:51:20 +00:00
|
|
|
return this.#maxEndTime;
|
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
#updateTimeRange(timeline) {
|
2020-08-04 13:51:20 +00:00
|
|
|
this.#minStartTime = Math.min(this.#minStartTime, timeline.startTime);
|
|
|
|
this.#maxEndTime = Math.max(this.#maxEndTime, timeline.endTime);
|
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
get mapTimeline() {
|
2020-08-04 08:51:59 +00:00
|
|
|
return this.#mapTimeline;
|
2020-07-28 12:46:10 +00:00
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
set mapTimeline(timeline) {
|
2020-08-04 13:51:20 +00:00
|
|
|
this.#updateTimeRange(timeline);
|
|
|
|
timeline.startTime = this.#minStartTime;
|
|
|
|
timeline.endTime = this.#maxEndTime;
|
|
|
|
this.#mapTimeline = timeline;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
set icTimeline(timeline) {
|
2020-08-04 13:51:20 +00:00
|
|
|
this.#updateTimeRange(timeline);
|
|
|
|
timeline.startTime = this.#minStartTime;
|
|
|
|
timeline.endTime = this.#maxEndTime;
|
|
|
|
this.#icTimeline = timeline;
|
2020-07-24 13:51:36 +00:00
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
get icTimeline() {
|
2020-08-04 08:51:59 +00:00
|
|
|
return this.#icTimeline;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
set chunks(value) {
|
2020-08-04 08:51:59 +00:00
|
|
|
//TODO(zcankara) split up between maps and ics, and every timeline track
|
|
|
|
this.#chunks = value;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
get chunks() {
|
2020-08-04 08:51:59 +00:00
|
|
|
//TODO(zcankara) split up between maps and ics, and every timeline track
|
|
|
|
return this.#chunks;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
get nofChunks() {
|
2020-08-04 08:51:59 +00:00
|
|
|
return this.#nofChunks;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
set nofChunks(count) {
|
2020-08-04 08:51:59 +00:00
|
|
|
this.#nofChunks = count;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
get map() {
|
2020-08-04 08:51:59 +00:00
|
|
|
//TODO(zcankara) rename as selectedMapEvents, array of selected events
|
2020-07-28 12:46:10 +00:00
|
|
|
return this.#map;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
|
|
|
set map(value) {
|
2020-08-04 08:51:59 +00:00
|
|
|
//TODO(zcankara) rename as selectedMapEvents, array of selected events
|
2020-08-13 09:14:29 +00:00
|
|
|
if (!value) return;
|
2020-07-28 12:46:10 +00:00
|
|
|
this.#map = value;
|
2020-07-23 06:37:37 +00:00
|
|
|
}
|
2020-07-28 12:46:10 +00:00
|
|
|
get ic() {
|
2020-08-04 08:51:59 +00:00
|
|
|
//TODO(zcankara) rename selectedICEvents, array of selected events
|
2020-07-28 12:46:10 +00:00
|
|
|
return this.#ic;
|
|
|
|
}
|
|
|
|
set ic(value) {
|
2020-08-04 08:51:59 +00:00
|
|
|
//TODO(zcankara) rename selectedIcEvents, array of selected events
|
2020-08-13 09:14:29 +00:00
|
|
|
if (!value) return;
|
2020-07-28 12:46:10 +00:00
|
|
|
this.#ic = value;
|
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
get selectedMapLogEvents() {
|
|
|
|
return this.#selectedMapLogEvents;
|
|
|
|
}
|
|
|
|
set selectedMapLogEvents(value) {
|
|
|
|
if (!value) return;
|
|
|
|
this.#selectedMapLogEvents = value;
|
|
|
|
}
|
2020-08-28 14:41:56 +00:00
|
|
|
get selectedSourcePositionLogEvents() {
|
|
|
|
return this.#selectedSourcePositionLogEvents;
|
|
|
|
}
|
|
|
|
set selectedSourcePositionLogEvents(value) {
|
|
|
|
this.#selectedSourcePositionLogEvents = value;
|
|
|
|
}
|
2020-08-13 09:14:29 +00:00
|
|
|
get selectedIcLogEvents() {
|
|
|
|
return this.#selectedIcLogEvents;
|
|
|
|
}
|
|
|
|
set selectedIcLogEvents(value) {
|
|
|
|
if (!value) return;
|
|
|
|
this.#selectedIcLogEvents = value;
|
|
|
|
}
|
2020-08-04 08:51:59 +00:00
|
|
|
get timeSelection() {
|
|
|
|
return this.#timeSelection;
|
|
|
|
}
|
2020-07-23 06:37:37 +00:00
|
|
|
get entries() {
|
|
|
|
if (!this.map) return {};
|
|
|
|
return {
|
|
|
|
map: this.map.id, time: this.map.time
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-28 12:46:10 +00:00
|
|
|
export { State };
|