Group

Description

A class for grouping objects.

Properties

length The number of members in the group.

Methods

addMember Adds an object to the group.
indexOf Returns the index of the object in the group.
isMember Checks if the object is a member of the group.
removeMember Removes an object from the group.
toFlatArray Converts the group and any nested groups into a single Array of group members.

Constructor

Group Creates a reference to a group.

Operators

[] Gets an individual group member by index.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

Group.length

int length

Description

The number of members in the group.

int numMembers = Group("Staff").length;
Do no remove, this fixes the anchor on doc.flexsim.com

Group.addMember()

void addMember( treenode object )

Parameters

object The object to add to the group.

Returns

void

Description

Adds an object to the group.

group.addMember(Model.find("Processor1"));
Do no remove, this fixes the anchor on doc.flexsim.com

Group.indexOf()

int indexOf( treenode object )

Parameters

object The object to find the index of.

Returns

int The index of the object in the group, 0 if it is not a member.

Description

Returns the index of the object in the group.

int index = group.indexOf(Model.find("Processor1"));
Do no remove, this fixes the anchor on doc.flexsim.com

Group.isMember()

int isMember( treenode object , int recursive )

Parameters

object The object to look for in the group.
recursive Should groups contained by this group also be searched.

Returns

int A 1 if the object is a member of the group, 0 otherwise.

Description

Checks if the object is a member of the group.

This code checks if Processor1 is a direct member of the group:

group.isMember(Model.find("Processor1"));

This code checks if Processor1 is a member of the group or the member of any of the groups contained by the group:

group.isMember(Model.find("Processor1"), 1);
Do no remove, this fixes the anchor on doc.flexsim.com

Group.removeMember()

void removeMember( treenode object )

Parameters

object The object to remove from the group.

Returns

void

Description

Removes an object from the group.

group.removeMember(Model.find("Processor1"));
Do no remove, this fixes the anchor on doc.flexsim.com

Group.toFlatArray()

Array toFlatArray( )

Returns

Array A single, flat Array of all the group members of the group and the members of any nested groups.

Description

Converts the group and any nested groups into a single Array of group members.

Array members = group.toFlatArray();
Do no remove, this fixes the anchor on doc.flexsim.com

Group Constructor

Group( string name )

Parameters

name The name of the group.

Description

Creates a reference to a group.

Group parts = Group("Packers");
Do no remove, this fixes the anchor on doc.flexsim.com

Group.operator []

Object operator []( int index )

Parameters

index The index of the desired group member.

Returns

Object The group member at the specified index.

Description

Gets an individual group member by index.

Object obj = Group("Machines")[2];