public virtual Group GetGroup(IMatcher matcher)
{
Group group;
if(!_groups.TryGetValue(matcher, out group)) {
group = new Group(matcher);
var entities = GetEntities();
for (int i = 0; i < entities.Length; i++) {
group.HandleEntitySilently(entities[i]);
}
_groups.Add(matcher, group);
for (int i = 0; i < matcher.indices.Length; i++) {
var index = matcher.indices[i];
if(_groupsForIndex[index] == null) {
_groupsForIndex[index] = new List<Group>();
}
_groupsForIndex[index].Add(group);
}
if(OnGroupCreated != null) {
OnGroupCreated(this, group);
}
}
return group;
}