@param  string                               $first_var_id
@param  array<string, array<string, bool>>   $assignment_map

@return int
555712
private static function getAssignmentMapDepth($first_var_id, array $assignment_map)
    {
        $max_depth = 0;

        $assignment_var_ids = $assignment_map[$first_var_id];
        unset($assignment_map[$first_var_id]);

        foreach ($assignment_var_ids as $assignment_var_id => $_) {
            $depth = 1;

            if (isset($assignment_map[$assignment_var_id])) {
                $depth = 1 + self::getAssignmentMapDepth($assignment_var_id, $assignment_map);
            }

            if ($depth > $max_depth) {
                $max_depth = $depth;
            }
        }

        return $max_depth;
    }
63693
public function set_link(string $id, string $id_link = null): ?int
  {
    return $this->db->update($this->class_cfg['table'], [
      $this->fields['id_link'] => $id_link
    ], [
      $this->fields['id'] => $id
    ]);
  }
542158
public static int getFirstRegisterSlot(Method m) {
        Type[] parms = m.getArgumentTypes();

        int first = m.isStatic() ? 0 : 1;
        for (Type t : parms) {
            first += getSignatureSize(t.getSignature());
        }

        return first;
    }
855560
private static int getDeterministicAssignment(double[] distribution) {
    int assignment = -1;
    for (int i = 0; i < distribution.length; i++) {
      if (distribution[i] == 1.0) {
        if (assignment == -1) assignment = i;
        else return -1;
      } else if (distribution[i] != 0.0) return -1;
    }
    return assignment;
  }
1101039
function ldap_get_one_entry_raw($id = "GENERIC", $first = FALSE, $srch_id = FALSE, $link_identifier = FALSE)
	{
        $linkIdentifier = ((FALSE !== $link_identifier) ? $link_identifier : $this->_conn_paged);
        $rawData = FALSE;
        if ($srch_id) {
            if ($first)
            {
                $this->_entry_identifier[$id] = ldap_first_entry($linkIdentifier, $srch_id);
            }
            elseif (FALSE !== $this->_entry_identifier[$id]) {
                $this->_entry_identifier[$id] = ldap_next_entry($linkIdentifier, $this->_entry_identifier[$id]);
            }
            if (FALSE !== $this->_entry_identifier[$id]) {
                $rawData = array();
                $rawData['count'] = 0; // To be compatible with the old data organisation (counter at the beginning)
                $attributes = ldap_get_attributes($linkIdentifier, $this->_entry_identifier[$id]);
                $distinguishedname_in_attributes = FALSE;

// echo "DEBUG attributes\n";
// print_r($attributes);
                for($j=0; $j<$attributes['count']; $j++) {
                    if ('distinguishedname' == strtolower($attributes[$j]))
                    {
                        $distinguishedname_in_attributes = TRUE;
                    }
                    $values = ldap_get_values_len($linkIdentifier, $this->_entry_identifier[$id],$attributes[$j]);
                    $rawData[strtolower($attributes[$j])] = $values;
                    $rawData[strtolower($attributes[$j])]['count'] = (isset($values['count'])?$values['count']:0);
                }
                if (!$distinguishedname_in_attributes)
                {
                    $rawData['distinguishedname'][0] = ldap_get_dn($linkIdentifier, $this->_entry_identifier[$id]);
                    $rawData['distinguishedname']['count'] = 1;
                    $attributes['count']++;
                }
                $rawData['count'] = $attributes['count'];
            }
        }
		return $rawData;
	}
1314265
public function removeFirst(&$assign = null)
    {
        $array = $this->val();

        if (count(func_get_args()) > 0) {
            $assign = $this->first()->val();
        }
        array_shift($array);

        $this->val($array);

        return $this;
    }
914007
function assign($name,$value=null){
        if(is_array($name)){
            foreach($name as $vk => $v){
                $this->vars[$vk] = $v;
            }
        }else{
            $this->vars[$name] = $value;
        }   
    }
309108
public static int arrayBindValueCount(Map<String, ParameterBindingDTO> bindValues)
  {
    if (!isArrayBind(bindValues))
    {
      return 0;
    }
    else
    {
      ParameterBindingDTO bindSample = bindValues.values().iterator().next();
      List<String> bindSampleValues = (List<String>) bindSample.getValue();
      return bindValues.size() * bindSampleValues.size();
    }
  }
697215
public Assignment outcomeToAssignment(List<String> factorVariables, List<? extends Object> outcome) {
    assert factorVariables.size() == outcome.size();

    int[] varNums = new int[factorVariables.size()];
    Object[] values = new Object[factorVariables.size()];
    for (int i = 0; i < factorVariables.size(); i++) {
      int varInd = getVariables().getVariableByName(factorVariables.get(i));
      varNums[i] = varInd;
      values[i] = outcome.get(i);
    }
    return Assignment.fromUnsortedArrays(varNums, values);
  }
260004
public void setFirst(int first) {

        if (first < 0) {
            throw new IllegalArgumentException(String.valueOf(first));
        }
        getStateHelper().put(PropertyKeys.first, first);

    }
672707
@SuppressWarnings("PointlessArithmeticExpression")
    int getDataFirstRecord(final int territoryNumber) {
        assert (0 <= territoryNumber) && (territoryNumber <= Territory.AAA.getNumber());
        return index[territoryNumber + POS_INDEX_FIRST_RECORD];
    }
149511
public function getJournalContent(int $first_party_id, int $second_party_id)
    {

        $journal = $this->characterWalletJournalInteractions($first_party_id, $second_party_id);

        return DataTables::of($journal)
            ->editColumn('ref_type', function ($row) {

                return view('web::partials.journaltranstype', compact('row'));
            })
            ->editColumn('first_party_id', function ($row) {

                $character_id = $row->character_id;

                if (optional($row->first_party)->category === 'character') {

                    $character = CharacterInfo::find($row->first_party_id) ?: $row->first_party_id;

                    return view('web::partials.character', compact('character', 'character_id'));
                }

                if (optional($row->first_party)->category === 'corporation'){

                    $corporation = CorporationInfo::find($row->first_party_id) ?: $row->first_party_id;

                    return view('web::partials.corporation', compact('corporation', 'character_id'));
                }

                return view('web::partials.unknown', [
                    'unknown_id' => $row->first_party_id,
                    'character_id' => $character_id,
                ]);
            })
            ->editColumn('second_party_id', function ($row) {

                $character_id = $row->character_id;

                if (optional($row->second_party)->category === 'character') {

                    $character = CharacterInfo::find($row->second_party_id) ?: $row->second_party_id;

                    return view('web::partials.character', compact('character', 'character_id'));
                }

                if (optional($row->second_party)->category === 'corporation') {

                    $corporation = CorporationInfo::find($row->second_party_id) ?: $row->second_party_id;

                    return view('web::partials.corporation', compact('corporation', 'character_id'));
                }

                return view('web::partials.unknown', [
                    'unknown_id' => $row->second_party_id,
                    'character_id' => $character_id,
                ]);
            })
            ->editColumn('amount', function ($row) {

                return number($row->amount);
            })
            ->editColumn('balance', function ($row) {

                return number($row->balance);
            })
            ->addColumn('is_in_group', function ($row) {

                return $row->character_id === $row->first_party_id || $row->character_id === $row->second_party_id;
            })
            ->rawColumns(['ref_type', 'first_party_id', 'second_party_id'])
            ->make(true);
    }
741656
private function comparePreReleaseIdentifier($identifier1, $identifier2) : int
    {
        $mineIsInt  = $this->isIdentifierInt($identifier1);
        $theirIsInt = $this->isIdentifierInt($identifier2);

        if ($mineIsInt !== $theirIsInt) {
            return $mineIsInt ? -1 : 1;
        }

        if ($mineIsInt) {
            return ((int) $identifier1) <=> ((int) $identifier2);
        }

        return $identifier1 <=> $identifier2;
    }
1207632
function GetAssoc($force_array = false, $first2cols = false)
	{
		$records = $this->_numOfRows;
		$results = array();
		for ( $i=0; $i < $records; $i++ ) {
			foreach ( $this->fields as $k=>$v ) {
				if ( is_array( $v ) ) {
					if ( $v['count'] == 1 ) {
						$results[$i][$k] = $v[0];
					} else {
						array_shift( $v );
						$results[$i][$k] = $v;
					}
				}
			}
		}

		return $results;
	}
219233
public function addAssignment
    (
        $query_name,
        $expression,
        $criteria,
        $atstart = false
    ) {
        //print("Added assign $query_name, $expression, $criteria<BR>");
        if ($atstart) {
            array_unshift($this->assignment, new Assignment
                (
                    $query_name,
                    $expression,
                    $criteria
                )
            );
        } else {
            $this->assignment[] = new Assignment
            (
                $query_name,
                $expression,
                $criteria
            );
        }

    }
1316638
def _get_first_part_id(self, assessment_id):
        """"""
        if assessment_id not in self._first_part_index:
            self._first_part_index[assessment_id] = get_first_part_id_for_assessment(
                assessment_id,
                runtime=self._runtime,
                proxy=self._proxy,
                create=True,
                bank_id=self._catalog_id)
        return self._first_part_index[assessment_id]
25394
function assignValue( $contentClassAttribute, $contentObjectAttribute )
    {

        $retValue = false;
        $ret = array();
        $version = $contentObjectAttribute->attribute( 'version' );
        $contentClassAttributeID = $contentClassAttribute->attribute( 'id' );
        $objectID = (int)$contentObjectAttribute->attribute( 'contentobject_id' );
        $classAttributeID = (int)$contentObjectAttribute->attribute( 'contentclassattribute_id' );

        $db = eZDB::instance();

        $existingIDs = $db->arrayQuery( "SELECT data_int " .
                                        "FROM   ezcontentobject_attribute " .
                                        "WHERE  contentobject_id = $objectID AND" .
                                        "       contentclassattribute_id = $classAttributeID AND" .
                                        "       data_type_string = 'ezidentifier' AND" .
                                        "       data_int != 0" );
        if ( count( $existingIDs ) > 0 )
        {
            $identifierValue = $existingIDs[0]['data_int'];
            $ret[] = eZIdentifierType::storeIdentifierValue( $contentClassAttribute, $contentObjectAttribute, $identifierValue );
        }
        else
        {
            $db->begin();

            // Ensure that we don't get another identifier with the same id, so lock ezcontentclass_attribute
            $db->lock( array( array( 'table' => 'ezcontentclass_attribute' ) ) );

            $selectQuery = "SELECT data_int3 FROM ezcontentclass_attribute WHERE " .
                 "id=$contentClassAttributeID AND version=0";
            $result = $db->arrayQuery( $selectQuery );
            $identifierValue = $result[0]['data_int3'];

            // should only increment when we don't have the first version
            $updateQuery = "UPDATE ezcontentclass_attribute SET data_int3=data_int3 + 1 WHERE " .
                  "id=$contentClassAttributeID AND version=0";

            $ret[] = $db->query( $updateQuery );

            $db->unlock();
            // unlock before we start to update the ezcontentobject_attribute table

            $ret[] = eZIdentifierType::storeIdentifierValue( $contentClassAttribute, $contentObjectAttribute, $identifierValue );

            if ( !in_array( false, $ret ) )
            {
                // Now make sure all existing versions (if any) gets the same identifier
                $dataText = $db->escapeString( $contentObjectAttribute->attribute( 'data_text' ) );
                $dataInt = (int)$contentObjectAttribute->attribute( 'data_int' );

                $trans = eZCharTransform::instance();
                $sortText = $db->escapeString( $trans->transformByGroup( $contentObjectAttribute->attribute( 'data_text' ),
                                                                         'lowercase' ) );

                $db->query( "UPDATE ezcontentobject_attribute " .
                            "SET    data_text = '$dataText', data_int = $dataInt, sort_key_string = '$sortText' " .
                            "WHERE  contentobject_id = $objectID AND" .
                            "       contentclassattribute_id = $classAttributeID AND" .
                            "       data_type_string = 'ezidentifier'" );
            }

            if ( !in_array( false, $ret ) )
                $db->commit();
            else
                $db->rollback();
        }

        if ( !in_array( false, $ret ) )
            $retValue = true;

        return $retValue;
    }