创建组，返回组对象

@param string $groupName
@param integer $maxClients
@return void
425374
public function createGroup(string $groupName, int $maxClients = -1)
    {
        if(!isset($this->groups[$groupName]))
        {
            $this->useRedis(function($resource, $redis) use($groupName){
                $redis->sAdd($this->getGroupsKey(), $groupName);
            });
            $this->groups[$groupName] = [
                'maxClient' => $maxClients,
            ];
        }
    }
200611
public function rule_max( $key, $value, $max )
	{
		return $this->rule_max_num( $key, strlen( $value ), $max );
	}
1070615
public function leaveGroup(string $groupName, int $fd)
    {
        $this->createGroup($groupName)->leave($fd);
    }
378598
public void addGroupBy(String[] fieldNames)
    {
        for (int i = 0; i < fieldNames.length; i++)
        {
            addGroupBy(fieldNames[i]);
        }
    }
552772
public function setMaxChoices($maxChoices)
    {
        if (is_int($maxChoices) === true && $maxChoices >= 0) {
            $this->maxChoices = $maxChoices;
        } else {
            $msg = "The 'maxChoices' argument must be a positive (>= 0) integer, '" . gettype($maxChoices) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1095650
private void addGroupName(int maxlength)
    {
        int maxisolength = 0;
        char offsets[] = new char[LINES_PER_GROUP_ + 2];
        char lengths[] = new char[LINES_PER_GROUP_ + 2];
        byte tokenlengths[] = new byte[m_tokentable_.length];

        // enumerate all groups
        // for (int i = m_groupcount_ - 1; i >= 0; i --) {
        for (int i = 0; i < m_groupcount_ ; i ++) {
            int offset = getGroupLengths(i, offsets, lengths);
            // enumerate all lines in each group
            // for (int linenumber = LINES_PER_GROUP_ - 1; linenumber >= 0;
            //    linenumber --) {
            for (int linenumber = 0; linenumber < LINES_PER_GROUP_;
                linenumber ++) {
                int lineoffset = offset + offsets[linenumber];
                int length = lengths[linenumber];
                if (length == 0) {
                    continue;
                }

                // read regular name
                int parsed[] = addGroupName(lineoffset, length, tokenlengths,
                                            m_nameSet_);
                if (parsed[0] > maxlength) {
                    // 0 for name length
                    maxlength = parsed[0];
                }
                lineoffset += parsed[1];
                if (parsed[1] >= length) {
                    // 1 for parsed group string length
                    continue;
                }
                length -= parsed[1];
                // read Unicode 1.0 name
                parsed = addGroupName(lineoffset, length, tokenlengths,
                                      m_nameSet_);
                if (parsed[0] > maxlength) {
                    // 0 for name length
                    maxlength = parsed[0];
                }
                lineoffset += parsed[1];
                if (parsed[1] >= length) {
                    // 1 for parsed group string length
                    continue;
                }
                length -= parsed[1];
                // read ISO comment
                parsed = addGroupName(lineoffset, length, tokenlengths,
                                      m_ISOCommentSet_);
                if (parsed[1] > maxisolength) {
                    maxisolength = length;
                }
            }
        }

        // set gMax... - name length last for threading
        m_maxISOCommentLength_ = maxisolength;
        m_maxNameLength_ = maxlength;
    }
644190
def set_max_clients(limit):
    
    global _dirty, _max_clients

    LOGGER.debug('Setting maximum client limit to %i', limit)
    _dirty = True
    _max_clients = limit
674752
public function removeGroup($groupName)
    {

		if(isset($this->groups[$groupName])){
			foreach($this->groups[$groupName]['elements'] as $element){
				$this->removeElement($element);
			}
			unset($this->groups[$groupName]);
		}

    }
218758
public function setMaxOperands($maxOperands)
    {
        if (is_int($maxOperands)) {
            $this->maxOperands = $maxOperands;
        } else {
            $msg = "The maxOperands argument must be an integer, '" . gettype($maxOperands) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
99596
protected function setMaxTokens(?int $maxTokens): self
    {
        assert($maxTokens === null || $maxTokens > 0);

        $this->maxTokens = $maxTokens > 0 ? $maxTokens : null;

        return $this;
    }
478603
public function addGroup($groupName, $nameSuffixes) {
    // @todo More performant dedicated implementation.
    foreach ($nameSuffixes as $suffix) {
      $this->addName($groupName . '.' . $suffix);
    }
  }
1188172
public function setMaxResults($maxResults)
    {
        $this->_maxResults = $maxResults;
        $this->_state      = self::STATE_DIRTY;

        return $this;
    }
1160494
public function addRowGroup($groupName, array $rowNameSuffixes) {
    if (empty($rowNameSuffixes)) {
      throw new \Exception("Suffixes cannot be empty.");
    }
    $rowNames = array();
    foreach ($rowNameSuffixes as $rowNameSuffix) {
      $rowName = $groupName . '.' . $rowNameSuffix;
      if (isset($this->rows[$rowName])) {
        throw new \Exception("Rowumn '$rowName' already exists.");
      }
      $this->addRowName($rowName);
      $rowNames[] = $rowName;
    }
    $this->rowGroups[$groupName] = $rowNames;
    return $this;
  }
156602
private
    function getMaxFightersByEntity($userGroups): int
    {
        return $userGroups
            ->sortByDesc(function ($group) {
                return $group->count();
            })
            ->first()
            ->count();
    }
1217159
public function bindSockets($addrs = [], $max = 0)
    {
        if (is_string($addrs)) {
            $addrs = array_map('trim', explode(',', $addrs));
        }
        $n = 0;
        foreach ($addrs as $addr) {
            if ($this->bindSocket($addr)) {
                ++$n;
            }
            if ($max > 0 && ($n >= $max)) {
                return $n;
            }
        }
        return $n;
    }
1127219
public function createGroupConversation($groupName, array $users)
    {
        $group = $this->query()->create([
            'name' => $groupName,
        ]);

        if ($group) {
            $group->users()->attach($users);

            return true;
        }

        return false;
    }
408818
public void updateMaxConnections (final int max) {

        try {
            Connection conn = taskBalancer.getConnection();
            int update = 0;
            int targetMaxC = connections.peek().getSettingAsInt(OperationalTextKey.MAX_CONNECTIONS);
            if (targetMaxC <= max) {
                if (targetMaxC > maxConnections) {
                    update = targetMaxC - maxConnections;
                    maxConnections = targetMaxC;
                }
            } else {
                if (max >= maxConnections) {
                    update = max - maxConnections;
                    maxConnections = max;
                }
            }

            SettingsMap sm = new SettingsMap();
            sm.add(OperationalTextKey.MAX_CONNECTIONS, String.valueOf(maxConnections));
            conn.update(sm);
            taskBalancer.releaseConnection(conn);

            if (update > 0) {
                addConnections(update);
            } else {
                for (int i = -1; i >= update; i--) {
                    taskBalancer.getConnection().close();
                }
            }

        } catch (Exception e) {
            // DO Nothing
        }

    }