Table of Contents

Class GroupHelper

Namespace
Geotab.Checkmate
Assembly
Geotab.Checkmate.ObjectModel.dll

This class contains helper methods related to stitch the groups back to the full hierarchy.

public class GroupHelper
Inheritance
GroupHelper
Inherited Members

Constructors

GroupHelper(Group)

Initializes a new instance of the GroupHelper class.

public GroupHelper(Group linkedGroup)

Parameters

linkedGroup Group

The Group in a completely linked group Hierarchy with the RootGroup on the top.

GroupHelper(IEnumerable<Group>)

Initializes a new instance of the GroupHelper class.

public GroupHelper(IEnumerable<Group> allGroups)

Parameters

allGroups IEnumerable<Group>

The hierarchy represented as an one-dimensional collection of all hierarchy groups populated, at minimum, by immediate Id-only children and no parent.

Fields

Empty

The empty GroupHelper.

public static readonly GroupHelper Empty

Field Value

GroupHelper

Methods

CloneGroup(Group, bool, bool)

Clones group structure.

public static Group CloneGroup(Group group, bool deepClone = false, bool keepParents = false)

Parameters

group Group

The original group.

deepClone bool

When true, the group is deeply cloned.

keepParents bool

When true, the parent group is added to the clone.

Returns

Group

The cloned group.

CloneGroups(ICollection<Group>, IEnumerable<Group>, bool, bool)

Clones groups collection to cloneGroups collection.

public static bool CloneGroups(ICollection<Group> cloneGroups, IEnumerable<Group> groups, bool deepClone = false, bool keepParents = false)

Parameters

cloneGroups ICollection<Group>

The result of cloning.

groups IEnumerable<Group>

The original groups.

deepClone bool

When true, the groups are deeply cloned.

keepParents bool

When true, the parent groups are added to the clones.

Returns

bool

True if groups collection is not empty.

GetGroup(Id)

Finds a Group by. Id

public Group? GetGroup(Id groupId)

Parameters

groupId Id

The. GroupId

Returns

Group

The Group.

GetPopulatedGroups(IEnumerable<Group>)

Populate the groups.

public IList<Group> GetPopulatedGroups(IEnumerable<Group> unpopulatedGroups)

Parameters

unpopulatedGroups IEnumerable<Group>

The unpopulated groups.

Returns

IList<Group>

The populated groups.

GetTrees()

Gets groups list where each group is a top parent of a linked tree.

public IList<Group> GetTrees()

Returns

IList<Group>

The. Group

HaveParentChildRelationship(IEnumerable<Group>?, Group)

Finds if any groups in a list have a parent child relationship to the group.

public static bool HaveParentChildRelationship(IEnumerable<Group>? groups, Group group)

Parameters

groups IEnumerable<Group>

The groups.

group Group

The group.

Returns

bool

If any groups have a parent child relationship.

IsGroupsChanged(IList<Group>)

Determine if it is possible to simplify a list of groups based on highest group rule.

public (bool IsChanged, IList<Group> CanonicalGroups) IsGroupsChanged(IList<Group> groupsToCheck)

Parameters

groupsToCheck IList<Group>

The groups.

Returns

(bool IsChanged, IList<Group> CanonicalGroups)

Whether has changed and the canonical groups.

IsPathChildOf(Group?, Group?)

Checks to see the child group is a children of the parent using the path

public static bool IsPathChildOf(Group? parent, Group? child)

Parameters

parent Group

The parent.

child Group

The child.

Returns

bool

bool

Traverse(IEnumerable<Group>)

Returns a collection that traverses the tree.

public IEnumerable<Group> Traverse(IEnumerable<Group> groupsToTraverse)

Parameters

groupsToTraverse IEnumerable<Group>

The groups.

Returns

IEnumerable<Group>

List<T>

TraverseUp(IEnumerable<Group>)

Returns a collection that traverses the tree up.

public IList<Group> TraverseUp(IEnumerable<Group> groupsToTraverseUp)

Parameters

groupsToTraverseUp IEnumerable<Group>

The groups.

Returns

IList<Group>

List<T>