new ResourceCollection()

Extends
module:meteoJS/synview/collection.Collection

Methods

append(resource) → module:meteoJS/synview/resourceCollection.ResourceCollection

Append a resource to the collection.

Parameter

Name Type Optional Description

resource

module:meteoJS/synview/resource.Resource

 

Resource.

Returns

module:meteoJS/synview/resourceCollection.ResourceCollection This.

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

boolean If 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

integer Index.

getItemById(id) → module:meteoJS/synview/resource.Resource

Parameter

Name Type Optional Description

id

mixed

 

ID.

Returns

module:meteoJS/synview/resource.Resource Resource.

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.

Returns

module:meteoJS/synview/resource.Resource 

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.Resource Resource.

getResources() → Array of module:meteoJS/synview/resource.Resource

Returns all resources assigned with time (ordered temporal upwardly).

Returns

Array of module:meteoJS/synview/resource.Resource Resources.

getTimes() → Array of Date

Returns times (ordered temporal upwardly).

Returns

Array of Date Times (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.

Returns

module:meteoJS/synview/resourceCollection.ResourceCollection This.

setResources(resources) → module:meteoJS/synview/resourceCollection.ResourceCollection

Exchanges the collection content with a list of resource.

Parameter

Name Type Optional Description

resources

Array of module:meteoJS/synview/resource.Resource

 

Resources.

Fires
module:meteoJS/synview/collection#add:item
module:meteoJS/synview/collection#replace:item
module:meteoJS/synview/collection#remove:item
Returns

module:meteoJS/synview/resourceCollection.ResourceCollection This.