styles_collection.js
2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { isPresent } from '../facade/lang';
export var StylesCollectionEntry = (function () {
/**
* @param {?} time
* @param {?} value
*/
function StylesCollectionEntry(time, value) {
this.time = time;
this.value = value;
}
/**
* @param {?} time
* @param {?} value
* @return {?}
*/
StylesCollectionEntry.prototype.matches = function (time, value) {
return time == this.time && value == this.value;
};
return StylesCollectionEntry;
}());
function StylesCollectionEntry_tsickle_Closure_declarations() {
/** @type {?} */
StylesCollectionEntry.prototype.time;
/** @type {?} */
StylesCollectionEntry.prototype.value;
}
export var StylesCollection = (function () {
function StylesCollection() {
this.styles = {};
}
/**
* @param {?} property
* @param {?} time
* @param {?} value
* @return {?}
*/
StylesCollection.prototype.insertAtTime = function (property, time, value) {
var /** @type {?} */ tuple = new StylesCollectionEntry(time, value);
var /** @type {?} */ entries = this.styles[property];
if (!isPresent(entries)) {
entries = this.styles[property] = [];
}
// insert this at the right stop in the array
// this way we can keep it sorted
var /** @type {?} */ insertionIndex = 0;
for (var /** @type {?} */ i = entries.length - 1; i >= 0; i--) {
if (entries[i].time <= time) {
insertionIndex = i + 1;
break;
}
}
entries.splice(insertionIndex, 0, tuple);
};
/**
* @param {?} property
* @param {?} index
* @return {?}
*/
StylesCollection.prototype.getByIndex = function (property, index) {
var /** @type {?} */ items = this.styles[property];
if (isPresent(items)) {
return index >= items.length ? null : items[index];
}
return null;
};
/**
* @param {?} property
* @param {?} time
* @return {?}
*/
StylesCollection.prototype.indexOfAtOrBeforeTime = function (property, time) {
var /** @type {?} */ entries = this.styles[property];
if (isPresent(entries)) {
for (var /** @type {?} */ i = entries.length - 1; i >= 0; i--) {
if (entries[i].time <= time)
return i;
}
}
return null;
};
return StylesCollection;
}());
function StylesCollection_tsickle_Closure_declarations() {
/** @type {?} */
StylesCollection.prototype.styles;
}
//# sourceMappingURL=styles_collection.js.map