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
Type for a group of entities
This action creates a new collection object.
This action deletes the collection.
This action sets the members of a collection.
This action adds members to a collection.
This action removes members from a collection.
This action specifies if a collection contains a given entity.
This action returns a list of entity objects in a collection.
This action returns the number of entities in a collection.
This action performs a command on each entity in the collection.
This action obtains the results of the last do operation.
This action returns a list of results in a collection.

Static Actions

create

pw::Collection create

This action creates a new collection object.

Parameters

None

Returns

This action returns a new pw::Collection object.

Instance Actions

delete

$collection 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_listThis 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_listThis 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_listThis 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

entityThis 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

$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

-strictThis optional flag checks the result for each entity, and returns an error for the command if the command failed for any one entity.
actionThis 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

entityThis parameter is the entity object of interest.
resultVarThis 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

$collection 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

pw::Collection create
This action creates a new collection object.
$collection delete
This action deletes the collection.
$collection set entity_list
This action sets the members of a collection.
$collection add entity_list
This action adds members to a collection.
$collection remove entity_list
This action removes members from a collection.
$collection contains entity
This action specifies if a collection contains a given entity.
$collection list
This action returns a list of entity objects in a collection.
$collection getEntityCount
This action returns the number of entities in a collection.
$collection do ?-strict? action ?args...?
This action performs a command on each entity in the collection.
$collection getResult entity ?resultVar?
This action obtains the results of the last do operation.
$collection resultList
This action returns a list of results in a collection.
Base type for all glyph types
Entity type
Node type
Edge type
Domain type
Connector and Curve segment type
Base class for distribution types
Base class for spacing types
Type for a group of entities
A boolean is represented as a 0 or 1, with 0 being false and 1 being true.
An integer is a whole number.
A string is an array of characters.