Constructor
new ResourceSelector(strategy, eqComparer)
Parameters:
Name | Type | Description |
---|---|---|
strategy |
ResourceSelectionStrategy | Number | |
eqComparer |
EqualityComparer.<T> |
- Source:
Extends
- Collection.<Resource.<T>>
Members
hasResources :Boolean
Type:
- Boolean
- Source:
strategy :ResourceSelectionStrategy|Number
Type:
- ResourceSelectionStrategy | Number
- Source:
strategy
- Source:
Methods
addResource(resource) → {this}
Parameters:
Name | Type | Description |
---|---|---|
resource |
T | A resource |
- Source:
Throws:
-
If the resource was added previously.
- Type
- Error
Returns:
- Type
- this
hasResource(resource) → {Boolean}
Note that this method compares the actual resource (@see {T}),
not its wrapper @see {Resource}.
Parameters:
Name | Type | Description |
---|---|---|
resource |
T |
- Source:
Returns:
- Type
- Boolean
removeResource(resource) → {this}
Remove a previously added resource from this selector.
Parameters:
Name | Type | Description |
---|---|---|
resource |
T | The resource to remove. |
- Source:
Returns:
- Type
- this
select() → {Resource.<T>}
The main method to select the next resource. You must not rely on the
expected order if all resources are yet unused
- Source:
Returns:
The next resource, according to the currently
selected strategy. It can be used by calling @see {Resource.use()}.
- Type
- Resource.<T>