/*!
Creates a new accumulator entry if one does not already exist and initializes with default data.
If \a $name is not supplied name is taken from \a $key.
If \a $inGroup is supplied it will place the accumulator under the specified group.
352724
static function createAccumulator( $key, $inGroup = false, $name = false )
    {
        if ( !eZDebug::isDebugEnabled() )
            return;
        if ( $name == '' or
             $name === false )
            $name = $key;
        $debug = eZDebug::instance();
        $isGroup = false;
        if ( array_key_exists( $key, $debug->TimeAccumulatorList ) and
             array_key_exists( $key, $debug->TimeAccumulatorGroupList ) )
            $isGroup = true;
        $debug->TimeAccumulatorList[$key] = array( 'name' => $name,  'time' => 0, 'count' => 0, 'is_group' => $isGroup, 'in_group' => $inGroup );
        if ( $inGroup !== false )
        {
            $groupKeys = array();
            if ( array_key_exists( $inGroup, $debug->TimeAccumulatorGroupList ) )
                $groupKeys = $debug->TimeAccumulatorGroupList[$inGroup];
            $debug->TimeAccumulatorGroupList[$inGroup] = array_unique( array_merge( $groupKeys, array( $key ) ) );
            if ( array_key_exists( $inGroup, $debug->TimeAccumulatorList ) )
                $debug->TimeAccumulatorList[$inGroup]['is_group'] = true;
        }
    }
734946
def add_group(opts)
      raise ArgumentError, "Expected Hash or Keepassx::Group, got #{opts.class}" unless valid_group?(opts)

      if opts.is_a?(Keepassx::Group)
        # Assign parent group
        parent = opts.parent
        index  = last_sibling_index(parent) + 1
        @groups.insert(index, opts)

        # Increment counter
        header.groups_count += 1

        # Return group
        opts

      elsif opts.is_a?(Hash)
        opts = deep_copy(opts)
        opts = build_group_options(opts)

        # Create group
        group = create_group(opts)

        # Increment counter
        header.groups_count += 1

        # Return group
        group
      end
    end
473937
private AccumulatorDefinition createAccumulatorDefinition(String name, String valueName, String statName){
		AccumulatorDefinition definition = new AccumulatorDefinition();
		definition.setName(name);
		definition.setProducerName(getProducerId());
		definition.setStatName(statName);
		definition.setValueName(valueName);
		definition.setIntervalName(MoskitoConfigurationHolder.getConfiguration().getErrorHandlingConfig().getAutoChartErrorsInterval());
		return definition;
	}
270302
function(oDD, sGroup) {
            if (!this.initialized) { this.init(); }
            
            if (!this.ids[sGroup]) {
                this.ids[sGroup] = {};
            }
            this.ids[sGroup][oDD.id] = oDD;
        }
501229
public function add($name, $value)
    {
        $name      = $this->normalizeName($name);
        $newValues = is_array($value) ? $value : [$value];
        $data      = [];
        if (isset($this->data[$name])) {
            $data = $this->data[$name];
        }

        $this->data[$name] = array_merge($data, $newValues);
    }
372215
public function preCreate(CreateEvent $event)
    {
        /** @var Group $role */
        $group = $event->getObject();
        $user = $this->tokenStorage->getToken()->getUser();

        if ($user instanceof User) {
            $group->addOrganization($user->getMainOrganization());
        }
    }
1044522
static function createAccumulatorGroup( $key, $name = false )
    {
        if ( !eZDebug::isDebugEnabled() )
            return;
        if ( $name == '' or
             $name === false )
            $name = $key;
        $debug = eZDebug::instance();
        if ( !array_key_exists( $key, $debug->TimeAccumulatorList ) )
            $debug->TimeAccumulatorList[$key] = array( 'name' => $name,  'time' => 0, 'count' => 0, 'is_group' => true, 'in_group' => false );
        if ( !array_key_exists( $key, $debug->TimeAccumulatorGroupList ) )
            $debug->TimeAccumulatorGroupList[$key] = array();
    }
342380
public function addGroup($group, $action, $priority = 0)
    {
        $this->assertNotFrozen();

        if (!empty($this->initialData[self::GROUPS][$action])) {
            foreach ($this->initialData[self::GROUPS][$action] as $existingGroup => $existingPriority) {
                if ($group !== $existingGroup && $priority === $existingPriority) {
                    throw new \InvalidArgumentException(
                        \sprintf(
                            'The priority %s cannot be used for the group "%s"'
                            . ' because the group with this priority already exists.'
                            . ' Existing group: "%s". Action: "%s".',
                            $priority,
                            $group,
                            $existingGroup,
                            $action
                        )
                    );
                }
            }
        }

        $this->initialData[self::GROUPS][$action][$group] = $priority;
    }
118321
public function addGroup(string $groupName, DataModifierGroup $group) : self
    {
        $this->dataModifierGroups[$groupName] = $group;

        return $this;
    }
1318259
public function update($key, $value, $group = self::DEFAULT_GROUP) {
        $this->repository->updateOrCreate($key, [
            'value' => $value,
            'group' => $group
        ]);

        return true;
    }
1128387
public function insertGroup(Group $group)
    {
        $q = $this->dbHandler->createInsertQuery();
        $q->insertInto(
            $this->dbHandler->quoteTable('ezcontentclassgroup')
        )->set(
            $this->dbHandler->quoteColumn('id'),
            $this->dbHandler->getAutoIncrementValue('ezcontentclassgroup', 'id')
        )->set(
            $this->dbHandler->quoteColumn('created'),
            $q->bindValue($group->created, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('creator_id'),
            $q->bindValue($group->creatorId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('modified'),
            $q->bindValue($group->modified, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('modifier_id'),
            $q->bindValue($group->modifierId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('name'),
            $q->bindValue($group->identifier)
        );
        $q->prepare()->execute();

        return $this->dbHandler->lastInsertId(
            $this->dbHandler->getSequenceName('ezcontentclassgroup', 'id')
        );
    }
1374510
public function addImplicitGroupName($group)
    {
        if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) {
            $this->groups[] = $group;
        }
    }
408863
protected function findOrCreateAdminGroup()
    {
        // Check pre-existing group
        $adminGroup = Permission::get_groups_by_permission('ADMIN')->first();
        if ($adminGroup) {
            return $adminGroup;
        }

        // Check if default records create the group
        Group::singleton()->requireDefaultRecords();
        $adminGroup = Permission::get_groups_by_permission('ADMIN')->first();
        if ($adminGroup) {
            return $adminGroup;
        }

        // Create new admin group directly
        $adminGroup = Group::create();
        $adminGroup->Code = 'administrators';
        $adminGroup->Title = _t('SilverStripe\\Security\\Group.DefaultGroupTitleAdministrators', 'Administrators');
        $adminGroup->Sort = 0;
        $adminGroup->write();
        Permission::grant($adminGroup->ID, 'ADMIN');
        return $adminGroup;
    }
703602
function init( $group, opts = {} ) {
    if ( !this.form ) {
        throw new Error( 'Widgets module not correctly instantiated with form property.' );
    }

    options = opts;
    formHtml = this.form.view.html; // not sure why this is only available in init

    const group = $group && $group.length ? $group[ 0 ] : formHtml;

    widgets.forEach( Widget => {
        _instantiate( Widget, group );
    } );

    return true;
}
298646
function incrementOrCreateGroup(object, group, value)
{
  if(!object[group]) object[group] = new Object();

  var myGroup = object[group];

  if(myGroup[value]) myGroup[value] += 1;
  else 		          myGroup[value] = 1;
}
468035
private void addEntry(K key, V value) {
    EntryImpl<K, V> entry = _poolFirst;
    if (entry != null) {
      _poolFirst = entry._after;
      entry._after = null;
    } else { // Pool empty.
      entry = new EntryImpl<K, V>();
    }

    // Setup entry paramters.
    entry._key = key;
    entry._value = value;
    int index = keyHash(key) & _mask;
    entry._index = index;

    // Connects to bucket.
    EntryImpl<K, V> next = _entries[index];
    entry._next = next;
    if (next != null) {
      next._previous = entry;
    }
    _entries[index] = entry;

    // Connects to collection.
    if (_mapLast != null) {
      entry._before = _mapLast;
      _mapLast._after = entry;
    } else {
      _mapFirst = entry;
    }
    _mapLast = entry;

    // Updates size.
    _size++;
    sizeChanged();
  }
419786
def add_group(self, group_name, payment_address):
        
        if (self.is_group_name_exists(group_name)):
            raise Exception("the group \"%s\" is already present"%str(group_name))
        group_id_base64 = base64.b64encode(secrets.token_bytes(32))
        self.m["groups"] += [{"group_name"      : group_name ,
                              "group_id"        : group_id_base64.decode("ascii"),
                              "payment_address" : payment_address}]
        return group_id_base64