GroupBuilderRuleCollection class

From Catglobe Wiki
Jump to: navigation, search

GroupBuilderRuleCollection



Represents a level of group builder rules.

Parent class

Inherits from object

Methods

  • Empty Add(GroupBuilderRule rule "Rule to add") - Add a new rule
  • object this[] { get; }(int index "Index") - Get rule at index
  • bool Remove(GroupBuilderRule rule "Rule to remove") - Remove rule. Return true if removed
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Set rule at index
  • (From object) string ToString() - The string representation of the object.

Properties

  • int Count { get; } - Number of rules at this level
  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.


Examples

Example: Add new rules

//Create a new group
string groupName = "Test Group Builder: GroupBuilderRuleCollection";
number groupTemplateResourceId=2066;
number parentResourceId = 11088827;
array group = Group_new(groupName, groupTemplateResourceId, parentResourceId);
Group_save(group);
number groupRId = group[GROUP_RESOURCE_ID ]; 
//Create rule for the group
GroupBuilderRoot root = new GroupBuilderRoot (groupRId);
GroupBuilderRule rule1 = new GroupBuilderRule (root);
GroupBuilderRule rule2 = new GroupBuilderRule (root);
GroupBuilderRule rule3 = new GroupBuilderRule (root);
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule1);
ruleColection.Add(rule2);
ruleColection.Add(rule3);
root.Save();


Example: Remove rule

GroupBuilderRoot root = new GroupBuilderRoot (15560827);
GroupBuilderRuleCollection ruleColection = root.RootRules;
print(ruleColection.Count);//3
GroupBuilderRule rule2 = ruleColection[1];
ruleColection.Remove(rule2);
print(ruleColection.Count);//2
root.Save();