meteoJS/synview/resourceCollection . ResourceCollection
Source: synview/
Collection of resource objects. Extends meteoJS.synview.collection with storage of time objects. This collection contains either a list of resources assigned with time or one resource with no time (or both). With the methods from meteoJS.synview.collection all resources (with or without time) will be retrieved. Id of the resource without time is '' (empty string).
new ResourceCollection()
Methods
append(resource) → module:meteoJS/synview/resourceCollection.ResourceCollection
Append a resource to the collection.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
resource |
|
Resource. |
containsId(id) → boolean
Returns if an ID exists in this collection.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
|
|
ID. |
- Inherited from
- module:meteoJS/synview/collection.Collection#containsId
- Returns
-
If exists.
containsTime() → boolean
Returns if a resource with passed time exists. Time could be invalid.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
Time. |
Date |
|
- Returns
-
booleanIf exists.
getCount() → integer
Returns count of items in this collection.
- Inherited from
- module:meteoJS/synview/collection.Collection#getCount
- Returns
-
Count.
getIndexById(id) → integer
Returns index of the item in this collecition, -1 if not existant.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
|
|
ID. |
- Inherited from
- module:meteoJS/synview/collection.Collection#getIndexById
- Returns
-
Index.
getIndexByTime(time) → integer
Returns index of the time inside the times array. Time could be invalid. -1 if not existant.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
time |
Date |
|
Time. |
- Returns
-
integerIndex.
getItemById(id) → module:meteoJS/synview/resource.Resource
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
mixed |
|
ID. |
- Returns
-
module:meteoJS/synview/resource.ResourceResource.
getItemIds() → Array of mixed
Returns a list of IDs (in order as appended).
- Inherited from
- module:meteoJS/synview/collection.Collection#getItemIds
- Returns
-
List of IDs.
getItems() → Array of Object
Returns items (in order as appended).
- Inherited from
- module:meteoJS/synview/collection.Collection#getItems
- Returns
-
Items.
getNewestResource() → module:meteoJS/synview/resource.Resource
Returns if a resource with ID exists in this collection.
getResourceByTime(time) → module:meteoJS/synview/resource.Resource
Returns resource valid at passed datetime (could be an invalid datetime). If resource doesn't exist, an empty object is returned.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
time |
Date |
|
Datetime. |
- Returns
-
module:meteoJS/synview/resource.ResourceResource.
getResources() → Array of module:meteoJS/synview/resource.Resource
Returns all resources assigned with time (ordered temporal upwardly).
- Returns
-
Array of module:meteoJS/synview/resource.ResourceResources.
getTimes() → Array of Date
Returns times (ordered temporal upwardly).
- Returns
-
Array of DateTimes (no invalid times).
remove(time) → module:meteoJS/synview/resourceCollection.ResourceCollection
Removes a resource from the collection.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
time |
Date |
|
Resource's time. |
setResources(resources) → module:meteoJS/synview/resourceCollection.ResourceCollection
Exchanges the collection content with a list of resource.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
resources |
|
Resources. |