f9905cac73c6c8d1346a941404774dc41b89d359
[atutor.git] / docs / jscripts / opensocial / collection.js
1 /**
2  * Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  *     http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  */
14
15 /**
16  * @fileoverview Collection of multiple objects with useful accessors.
17  *
18  * May also represent subset of a larger collection (i.e. page 1 of 10), and
19  * contain information about the larger collection.
20  */
21
22
23 /**
24  * @class
25  * Collection of multiple objects with useful accessors.
26  * May also represent subset of a larger collection
27  * (for example, page 1 of 10)
28  * and contain information about the larger collection.
29  *
30  * @name opensocial.Collection
31  */
32
33
34 /**
35  * Create a collection.
36  *
37  * @private
38  * @constructor
39  */
40 opensocial.Collection = function() {};
41
42
43 /**
44  * Finds the entry with the given ID value, or returns null if none is found.
45  * @param {String} id The ID to look for
46  * @return {Object?} The data
47  */
48 opensocial.Collection.prototype.getById = function(id) {};
49
50
51 /**
52  * Gets the size of this collection,
53  * which is equal to or less than the
54  * total size of the result.
55  * @return {Number} The size of this collection
56  */
57 opensocial.Collection.prototype.size = function() {};
58
59
60 /**
61  * Executes the provided function once per member of the collection,
62  * with each member in turn as the
63  * parameter to the function.
64  * @param {Function} fn The function to call with each collection entry
65  */
66 opensocial.Collection.prototype.each = function(fn) {};
67
68
69 /**
70  * Returns an array of all the objects in this collection.
71  * @return {Array.<Object>} The values in this collection
72  */
73 opensocial.Collection.prototype.asArray = function() {};
74
75
76 /**
77  * Gets the total size of the larger result set
78  * that this collection belongs to.
79  * @return {Number} The total size of the result
80  */
81 opensocial.Collection.prototype.getTotalSize = function() {};
82
83
84 /**
85  * Gets the offset of this collection within a larger result set.
86  * @return {Number} The offset into the total collection
87  */
88 opensocial.Collection.prototype.getOffset = function() {};