pw::Collection
Type for a group of entities
Derives From
pw::Object
Information
In the context of the pw::Collection, an entity refers to objects of or derived from the following types:
Summary
pw::Collection | Type for a group of entities |
Static Actions | |
create | This action creates a new collection object. |
Instance Actions | |
delete | This action deletes the collection. |
set | This action sets the members of a collection. |
add | This action adds members to a collection. |
remove | This action removes members from a collection. |
contains | This action specifies if a collection contains a given entity. |
list | This action returns a list of entity objects in a collection. |
getEntityCount | This action returns the number of entities in a collection. |
do | This action performs a command on each entity in the collection. |
getResult | This action obtains the results of the last do operation. |
resultList | This action returns a list of results in a collection. |
create
This action creates a new collection object.
Parameters
None
Returns
This action returns a new pw::Collection object.
delete
This action deletes the collection.
Parameters
None
Returns
This action returns nothing.
set
$collection set entity_list |
This action sets the members of a collection. Any existing membership is cleared.
Parameters
entity_list | This parameter is a list of entity objects to assign to the collection. |
Returns
This action returns the pw::Collection object.
add
$collection add entity_list |
This action adds members to a collection. Any existing membership is not changed.
Parameters
entity_list | This parameter is the list of entity objects to add to the collection. |
Returns
This action returns the pw::Collection object.
remove
$collection remove entity_list |
This action removes members from a collection.
Parameters
entity_list | This parameter is the list of entity objects to remove from the collection. |
Returns
This action returns the pw::Collection object.
contains
$collection contains entity |
This action specifies if a collection contains a given entity.
Parameters
entity | This parameter is the entity object to check for. |
Returns
This action returns a boolean, which is true if the entity is in the collection.
list
This action returns a list of entity objects in a collection.
Parameters
None
Returns
This action returns the a list of entity objects.
getEntityCount
$collection getEntityCount |
This action returns the number of entities in a collection.
Parameters
None
Returns
This action returns the integer entity count.
do
$collection do ?-strict? action ?args...? |
This action performs a command on each entity in the collection.
Parameters
-strict | This optional flag checks the result for each entity, and returns an error for the command if the command failed for any one entity. |
action | This parameter is the name string of the action to be performed by each entity. |
args... | These parameters are a sequence of zero or more action arguments. |
Returns
This action returns a boolean, which is false if one of the commands changed the membership status of one or more entities, indicating that not all entities may have been processed.
See Also
getResult
getResult
$collection getResult entity ?resultVar? |
This action obtains the results of the last do operation.
Parameters
entity | This parameter is the entity object of interest. |
resultVar | This parameter is the name string of the boolean variable to hold the entity result value. If the action was successful for this entity, the variable will be set to true. |
Returns
This action returns the command-specific result of the action on the given entity.
Information
An error is raised if the entity is not in the collection.
See Also
do
resultList
This action returns a list of results in a collection.
Parameters
None
Returns
This action returns the result list. Note: the order of the result list is guaranteed only to be in the same order as the list returned by list, which may not be the same as the order the objects were added to the collection.
See Also
list