Merge pull request #8083 from pfirpfel/move-structs-typedefs-to-ol/structs
Move structs typedefs to ol/structs/*
This commit is contained in:
@@ -6,6 +6,16 @@ import {assert} from '../asserts.js';
|
|||||||
import EventTarget from '../events/EventTarget.js';
|
import EventTarget from '../events/EventTarget.js';
|
||||||
import EventType from '../events/EventType.js';
|
import EventType from '../events/EventType.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Entry
|
||||||
|
* @property {string} key_
|
||||||
|
* @property {Object} newer
|
||||||
|
* @property {Object} older
|
||||||
|
* @property {*} value_
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a Least-Recently-Used cache where the keys do not conflict with
|
* Implements a Least-Recently-Used cache where the keys do not conflict with
|
||||||
* Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring
|
* Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring
|
||||||
@@ -34,19 +44,19 @@ const LRUCache = function(opt_highWaterMark) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {!Object.<string, ol.LRUCacheEntry>}
|
* @type {!Object.<string, module:ol/structs/LRUCache~Entry>}
|
||||||
*/
|
*/
|
||||||
this.entries_ = {};
|
this.entries_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.LRUCacheEntry}
|
* @type {?module:ol/structs/LRUCache~Entry}
|
||||||
*/
|
*/
|
||||||
this.oldest_ = null;
|
this.oldest_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.LRUCacheEntry}
|
* @type {?module:ol/structs/LRUCache~Entry}
|
||||||
*/
|
*/
|
||||||
this.newest_ = null;
|
this.newest_ = null;
|
||||||
|
|
||||||
@@ -112,7 +122,7 @@ LRUCache.prototype.get = function(key) {
|
|||||||
if (entry === this.newest_) {
|
if (entry === this.newest_) {
|
||||||
return entry.value_;
|
return entry.value_;
|
||||||
} else if (entry === this.oldest_) {
|
} else if (entry === this.oldest_) {
|
||||||
this.oldest_ = /** @type {ol.LRUCacheEntry} */ (this.oldest_.newer);
|
this.oldest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (this.oldest_.newer);
|
||||||
this.oldest_.older = null;
|
this.oldest_.older = null;
|
||||||
} else {
|
} else {
|
||||||
entry.newer.older = entry.older;
|
entry.newer.older = entry.older;
|
||||||
@@ -135,12 +145,12 @@ LRUCache.prototype.remove = function(key) {
|
|||||||
const entry = this.entries_[key];
|
const entry = this.entries_[key];
|
||||||
assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
|
assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
|
||||||
if (entry === this.newest_) {
|
if (entry === this.newest_) {
|
||||||
this.newest_ = /** @type {ol.LRUCacheEntry} */ (entry.older);
|
this.newest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (entry.older);
|
||||||
if (this.newest_) {
|
if (this.newest_) {
|
||||||
this.newest_.newer = null;
|
this.newest_.newer = null;
|
||||||
}
|
}
|
||||||
} else if (entry === this.oldest_) {
|
} else if (entry === this.oldest_) {
|
||||||
this.oldest_ = /** @type {ol.LRUCacheEntry} */ (entry.newer);
|
this.oldest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (entry.newer);
|
||||||
if (this.oldest_) {
|
if (this.oldest_) {
|
||||||
this.oldest_.older = null;
|
this.oldest_.older = null;
|
||||||
}
|
}
|
||||||
@@ -224,7 +234,7 @@ LRUCache.prototype.pop = function() {
|
|||||||
if (entry.newer) {
|
if (entry.newer) {
|
||||||
entry.newer.older = null;
|
entry.newer.older = null;
|
||||||
}
|
}
|
||||||
this.oldest_ = /** @type {ol.LRUCacheEntry} */ (entry.newer);
|
this.oldest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (entry.newer);
|
||||||
if (!this.oldest_) {
|
if (!this.oldest_) {
|
||||||
this.newest_ = null;
|
this.newest_ = null;
|
||||||
}
|
}
|
||||||
@@ -250,7 +260,7 @@ LRUCache.prototype.replace = function(key, value) {
|
|||||||
LRUCache.prototype.set = function(key, value) {
|
LRUCache.prototype.set = function(key, value) {
|
||||||
assert(!(key in this.entries_),
|
assert(!(key in this.entries_),
|
||||||
16); // Tried to set a value for a key that is used already
|
16); // Tried to set a value for a key that is used already
|
||||||
const entry = /** @type {ol.LRUCacheEntry} */ ({
|
const entry = /** @type {module:ol/structs/LRUCache~Entry} */ ({
|
||||||
key_: key,
|
key_: key,
|
||||||
newer: null,
|
newer: null,
|
||||||
older: this.newest_,
|
older: this.newest_,
|
||||||
|
|||||||
@@ -2,6 +2,15 @@
|
|||||||
* @module ol/structs/LinkedList
|
* @module ol/structs/LinkedList
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Item
|
||||||
|
* @property {module:ol/structs/LinkedList~Item} [prev]
|
||||||
|
* @property {module:ol/structs/LinkedList~Item} [next]
|
||||||
|
* @property {?} data
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty linked list structure.
|
* Creates an empty linked list structure.
|
||||||
*
|
*
|
||||||
@@ -14,19 +23,19 @@ const LinkedList = function(opt_circular) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.LinkedListItem|undefined}
|
* @type {module:ol/structs/LinkedList~Item}|undefined}
|
||||||
*/
|
*/
|
||||||
this.first_ = undefined;
|
this.first_ = undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.LinkedListItem|undefined}
|
* @type {module:ol/structs/LinkedList~Item}|undefined}
|
||||||
*/
|
*/
|
||||||
this.last_ = undefined;
|
this.last_ = undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.LinkedListItem|undefined}
|
* @type {module:ol/structs/LinkedList~Item}|undefined}
|
||||||
*/
|
*/
|
||||||
this.head_ = undefined;
|
this.head_ = undefined;
|
||||||
|
|
||||||
@@ -50,7 +59,7 @@ const LinkedList = function(opt_circular) {
|
|||||||
*/
|
*/
|
||||||
LinkedList.prototype.insertItem = function(data) {
|
LinkedList.prototype.insertItem = function(data) {
|
||||||
|
|
||||||
/** @type {ol.LinkedListItem} */
|
/** @type {module:ol/structs/LinkedList~Item}} */
|
||||||
const item = {
|
const item = {
|
||||||
prev: undefined,
|
prev: undefined,
|
||||||
next: undefined,
|
next: undefined,
|
||||||
|
|||||||
@@ -120,14 +120,6 @@ ol.CanvasTextState;
|
|||||||
ol.DeclutterGroup;
|
ol.DeclutterGroup;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {{prev: (ol.LinkedListItem|undefined),
|
|
||||||
* next: (ol.LinkedListItem|undefined),
|
|
||||||
* data: ?}}
|
|
||||||
*/
|
|
||||||
ol.LinkedListItem;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and
|
* A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and
|
||||||
* returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this
|
* returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this
|
||||||
@@ -138,15 +130,6 @@ ol.LinkedListItem;
|
|||||||
ol.LoadingStrategy;
|
ol.LoadingStrategy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {{key_: string,
|
|
||||||
* newer: Object,
|
|
||||||
* older: Object,
|
|
||||||
* value_: *}}
|
|
||||||
*/
|
|
||||||
ol.LRUCacheEntry;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function that takes an array of input data, performs some operation, and
|
* A function that takes an array of input data, performs some operation, and
|
||||||
* returns an array of output data.
|
* returns an array of output data.
|
||||||
|
|||||||
Reference in New Issue
Block a user