Group

@Serializable
data class Group(_name: String, val address: PrimaryGroupAddress)

Group defines a GroupAddress of type PrimaryGroupAddress to which a node may subscribe to.

If a node is part of a Group, at least one model of the node is subscribed to the Group’s group address. A Group may have a Parent Group. In this case, all the models of a node that are subscribed to the Group’s address are also subscribed to the Parent Group’s address.

For example, the Second-Floor Group is a parent of the Bedroom Group and the Guest Bedroom Group. In this case, at least one model of all the nodes of the Bedroom Group is subscribed to a group address or virtual label of the Bedroom Group and Second-Floor Group; and at least one model of all the nodes of the Guest Bedroom Group is subscribed to the group address or virtual label of the Guest Bedroom Group and the Second-Floor Group. Note library does not validate for cyclic parent-groups.

Constructors

Link copied to clipboard
constructor(_name: String, address: PrimaryGroupAddress)

Properties

Link copied to clipboard

Address of the group.

Link copied to clipboard
Link copied to clipboard

Group name.

Link copied to clipboard

Functions

Link copied to clipboard

Returns a list of elements with at least one model subscribed to this group.

Link copied to clipboard
fun isChildOf(parent: Group): Boolean

Returns whether this Group is a child group of the given one.

Link copied to clipboard

Returns whether this Group is a direct child group of the given one.

Link copied to clipboard

Returns whether this Group is the parent group of the given one.

Link copied to clipboard
fun isParentOf(child: Group): Boolean

Returns whether this Group is a parent group of the given one.

Link copied to clipboard
fun nodes(): List<Node>

Returns a list of nodes with at least one model on any element subscribed to this group.

Link copied to clipboard
fun setAsChildOf(parent: Group)

Sets the parent-child relationship between this and the given Group.

Link copied to clipboard
fun setAsParentOf(child: Group)

Sets the parent-child relationship between this and the given Group.