merge url

@param userDatas
@param configDatas
@return
17432
List<ProviderInfo> mergeProviderInfo(List<String> userDatas, List<String> configDatas) {
        // 是否自己缓存运算后的结果？？ TODO
        List<ProviderInfo> providers = SofaRegistryHelper.parseProviderInfos(userDatas);
        // 交叉比较
        if (CommonUtils.isNotEmpty(providers) && CommonUtils.isNotEmpty(configDatas)) {
            List<ProviderInfo> override = SofaRegistryHelper.parseProviderInfos(configDatas);
            Iterator<ProviderInfo> iterator = providers.iterator();
            while (iterator.hasNext()) {
                ProviderInfo origin = iterator.next();
                for (ProviderInfo over : override) {
                    if (PROTOCOL_TYPE_OVERRIDE.equals(over.getProtocolType()) &&
                        StringUtils.equals(origin.getHost(), over.getHost()) && origin.getPort() == over.getPort()) {
                        // host 和 port 相同 认为是一个地址
                        if (over.getWeight() != origin.getWeight()) {
                            origin.setWeight(over.getWeight());
                        }
                        if (CommonUtils.isTrue(over.getAttr(ProviderInfoAttrs.ATTR_DISABLED))) {
                            if (LOGGER.isInfoEnabled()) {
                                LOGGER.info("Provider is disabled by override. {}", origin.toUrl());
                            }
                            iterator.remove(); // 禁用 删掉
                        }
                    }
                }
            }
        }
        return providers;
    }
838098
public LCMSDataSubset merge(LCMSDataSubset other) {
    LCMSDataSubset merged = new LCMSDataSubset();

    Set<Integer> msLvlsThis = getMsLvls();
    Set<Integer> msLvlsThat = other.getMsLvls();
    // only merge if both are not null, otherwise null signifies the whole
    // run, so we can keep it null in the merged version
    if (msLvlsThis != null && msLvlsThat != null) {
      HashSet<Integer> mergedMsLvls = new HashSet<>(msLvlsThis);
      mergedMsLvls.addAll(msLvlsThat);
      merged.setMsLvls(mergedMsLvls);
    }

    // merge mz ranges
    List<DoubleRange> mzRangesThis = getMzRanges();
    List<DoubleRange> mzRangesThat = other.getMzRanges();
    if (mzRangesThis != null && mzRangesThat != null) {
      ArrayList<DoubleRange> mergedMzRanges = new ArrayList<>(mzRangesThis);
      mergedMzRanges.addAll(mzRangesThat);
      merged.setMzRanges(mergedMzRanges);
    }

    // compare scan number ranges
    Integer scanNumLoThis = getScanNumLo();
    Integer scanNumLoThat = other.getScanNumLo();
    if (scanNumLoThis != null && scanNumLoThat != null) {
      merged.setScanNumLo(Math.min(scanNumLoThis, scanNumLoThat));
    }
    Integer scanNumHiThis = getScanNumHi();
    Integer scanNumHiThat = other.getScanNumHi();
    if (scanNumHiThis != null && scanNumHiThat != null) {
      merged.setScanNumHi(Math.max(scanNumHiThis, scanNumHiThat));
    }

    return merged;
  }
1149712
public static Map<String, List<Object>> mergeAttributes(final Map<String, List<Object>> currentAttributes, final Map<String, List<Object>> attributesToMerge) {
        val merger = new MultivaluedAttributeMerger();

        val toModify = currentAttributes.entrySet()
            .stream()
            .map(entry -> Pair.of(entry.getKey(), CollectionUtils.toCollection(entry.getValue(), ArrayList.class)))
            .collect(Collectors.toMap(Pair::getKey, Pair::getValue));

        val toMerge = attributesToMerge.entrySet()
            .stream()
            .map(entry -> Pair.of(entry.getKey(), CollectionUtils.toCollection(entry.getValue(), ArrayList.class)))
            .collect(Collectors.toMap(Pair::getKey, Pair::getValue));

        LOGGER.trace("Merging current attributes [{}] with [{}]", toModify, toMerge);
        val results = merger.mergeAttributes((Map) toModify, (Map) toMerge);
        LOGGER.debug("Merged attributes with the final result as [{}]", results);
        return results;
    }
205302
function mergeConfig(loaderConfig) {
  var defaultConfig = {
    // Web3
    provider: 'http://localhost:8545',

    // For deployment
    from: web3.eth.accounts[0],
    gasLimit: web3.eth.getBlock(web3.eth.defaultBlock).gasLimit,

    // Specify contract constructor parameters, if any.
    // constructorParams: {
    //   ContractOne: [ 'param1_value', 'param2_value' ]
    // }
    constructorParams: {},

    // To use deployed contracts instead of redeploying, include contract addresses in config
    // deployedContracts: {
    //   ContractOne: '0x...........',
    //   ContractTwo: '0x...........',
    // }
    deployedContracts: {}
  };

  var mergedConfig = loaderConfig;
  for (var key in defaultConfig) {
    if (!mergedConfig.hasOwnProperty(key)) {
      mergedConfig[key] = defaultConfig[key];
    }
  }
  return mergedConfig;
}
1131639
function mergeActions(actions, userActions) {
  const overrides = {};
  for (const key in userActions) {
    if (userActions.hasOwnProperty(key) && actions.hasOwnProperty(key)) {
      overrides[key] = userActions[key];
    }
  }

  return {...actions, ...overrides};
}
715123
public static ConfigParams mergeConfigs(ConfigParams... configs) {
		StringValueMap map = StringValueMap.fromMaps(configs);
		return new ConfigParams(map);
	}
52617
static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) {
        for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) {
            Object existing = original.get(entry.getKey());
            if (existing != null) {
                ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription);
            } else {
                original.put(entry.getKey(), entry.getValue());
            }
        }
    }
611827
@Override
    public final Set<IPersonAttributes> mergeResults(final Set<IPersonAttributes> toModify, final Set<IPersonAttributes> toConsider) {
        Validate.notNull(toModify, "toModify cannot be null");
        Validate.notNull(toConsider, "toConsider cannot be null");

        //Convert the toModify Set into a Map to allow for easier lookups
        final Map<String, IPersonAttributes> toModfyPeople = new LinkedHashMap<>();
        for (final IPersonAttributes toModifyPerson : toModify) {
            toModfyPeople.put(toModifyPerson.getName(), toModifyPerson);
        }

        //Merge in the toConsider people
        for (final IPersonAttributes toConsiderPerson : toConsider) {
            final String toConsiderName = toConsiderPerson.getName();
            final IPersonAttributes toModifyPerson = toModfyPeople.get(toConsiderName);

            //No matching toModify person, just add the new person
            if (toModifyPerson == null) {
                toModify.add(toConsiderPerson);
            }
            //Matching toModify person, merge their attributes
            else {
                final Map<String, List<Object>> toModifyAttributes = this.buildMutableAttributeMap(toModifyPerson.getAttributes());
                final Map<String, List<Object>> mergedAttributes = this.mergePersonAttributes(toModifyAttributes, toConsiderPerson.getAttributes());
                final NamedPersonImpl mergedPerson = new NamedPersonImpl(toConsiderName, mergedAttributes);

                //Remove then re-add the mergedPerson entry
                toModify.remove(mergedPerson);
                toModify.add(mergedPerson);
            }
        }

        return toModify;
    }
568397
public <T> void setUsermetaData(RiakUserMetadata userMetadata, T obj)
    {
        Field mapField = null;
        for (UsermetaField uf : usermetaFields)
        {
            switch (uf.getFieldType())
            {
                case STRING:
                    if (userMetadata.containsKey(uf.getUsermetaDataKey()))
                    {
                        setFieldValue(uf.getField(), obj, userMetadata.get(uf.getUsermetaDataKey()));
                        userMetadata.remove(uf.getUsermetaDataKey());
                    }
                    break;
                case MAP:
                    mapField = uf.getField();
                    break;
                default:
                    break;
            }
        }

        Method mapSetter = null;
        for (UsermetaMethod um : usermetaMethods)
        {
            switch (um.getMethodType())
            {
                case STRING_SETTER:
                    if (userMetadata.containsKey(um.getUsermetaDataKey()))
                    {
                        setMethodValue(um.getMethod(), obj, userMetadata.get(um.getUsermetaDataKey()));
                        userMetadata.remove(um.getUsermetaDataKey());
                    }
                    break;
                case MAP_SETTER:
                    mapSetter = um.getMethod();
                    break;
                default:
                    break;
            }
        }

        if (mapSetter != null || mapField != null)
        {
            Map<String,String> mapCopy = new HashMap<>(userMetadata.size());
            for (Map.Entry<BinaryValue,BinaryValue> entry : userMetadata.getUserMetadata())
            {
                mapCopy.put(entry.getKey().toString(), entry.getValue().toString());
            }

            if (mapSetter != null)
            {
                setMethodValue(mapSetter, obj, mapCopy);
            }

            if (mapField != null)
            {
                setFieldValue(mapField, obj, mapCopy);
            }
        }
    }
377164
@Override
    protected LofDataSet mergeState(LofDataSet baseDataSet, LofDataSet targetDataSet,
            Map<String, Object> mergeConfig)
    {
        int kn = Integer.parseInt(mergeConfig.get(LofConfKey.KN).toString());
        int maxDataCount = Integer.parseInt(mergeConfig.get(LofConfKey.MAX_DATA_COUNT).toString());

        // 学習データの保持する対象点を新しい方から最大保持数個だけ取得
        LofDataSet mergedDataSet = LofCalculator.mergeDataSet(baseDataSet, targetDataSet,
                maxDataCount);

        // 中間データ保持設定が存在しない場合は中間データの生成は行わない。
        if (mergeConfig.containsKey(LofConfKey.HAS_INTERMEDIATE) == false)
        {
            return mergedDataSet;
        }

        // 中間データ保持設定が存在し、かつ「true」の場合のみ中間データの生成を行う。
        if (Boolean.getBoolean(mergeConfig.get(LofConfKey.HAS_INTERMEDIATE).toString()) == true)
        {
            LofCalculator.initDataSet(kn, mergedDataSet);
        }

        return mergedDataSet;
    }
1274516
protected String buildContextURL(ODataRequestContext requestContext, Object data) throws ODataRenderException {
        ODataUri oDataUri = requestContext.getUri();
        if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) {
            return buildContextUrlFromOperationCall(oDataUri, requestContext.getEntityDataModel(),
                    isListOrStream(data));
        }

        Option<String> contextURL;
        if (isWriteOperation(requestContext)) {
            contextURL = getContextUrlWriteOperation(oDataUri);
        } else {
            contextURL = getContextUrl(oDataUri);
        }
        checkContextURL(requestContext, contextURL);
        return contextURL.get();
    }
1157021
protected static final Map<String, ArrayList<String>> parseUserData(String userData) {
        int tokenLen = userData.length();
        int numOfAttribs = 1; // default has "user" (u) attribute
        int lastDelim = 0;
        int i = 0;
        Map<String, ArrayList<String>> attribs = new HashMap<String, ArrayList<String>>();

        for (i = 0; i < tokenLen; i++) {
            if ((userData.charAt(i) == USER_DATA_DELIM) && (userData.charAt(i - 1) != '\\')) {
                numOfAttribs++;
                String data = userData.substring(lastDelim, i);
                lastDelim = i + 1;
                addAttributes(data, attribs);
            }
        }

        // add the last element
        String data = userData.substring(lastDelim, tokenLen);
        addAttributes(data, attribs);

        return attribs;
    }
1316820
public function Merge($OldUserID, $NewUserID) {
      $OldUser = $this->GetID($OldUserID, DATASET_TYPE_ARRAY);
      $NewUser = $this->GetID($NewUserID, DATASET_TYPE_ARRAY);
      
      if (!$OldUser || !$NewUser) {
         throw new Gdn_UserException("Could not find one or both users to merge.");
      }
      
      $Map = array('UserID', 'Name', 'Email', 'CountVisits', 'CountDiscussions', 'CountComments');
      
      $Result = array('MergeID' => NULL, 'Before' => array(
         'OldUser' => ArrayTranslate($OldUser, $Map),
         'NewUser' => ArrayTranslate($NewUser, $Map)));
      
      // Start the merge.
      $MergeID = $this->MergeStart($OldUserID, $NewUserID);
      
      // Copy all discussions from the old user to the new user.
      $this->MergeCopy($MergeID, 'Discussion', 'InsertUserID', $OldUserID, $NewUserID);
      
      // Copy all the comments from the old user to the new user.
      $this->MergeCopy($MergeID, 'Comment', 'InsertUserID', $OldUserID, $NewUserID);
      
      // Copy all of the activities.
      $this->MergeCopy($MergeID, 'Activity', 'NotifyUserID', $OldUserID, $NewUserID);
      $this->MergeCopy($MergeID, 'Activity', 'InsertUserID', $OldUserID, $NewUserID);
      $this->MergeCopy($MergeID, 'Activity', 'ActivityUserID', $OldUserID, $NewUserID);
      
      // Copy all of the activity comments.
      $this->MergeCopy($MergeID, 'ActivityComment', 'InsertUserID', $OldUserID, $NewUserID);
      
      // Copy all conversations.
      $this->MergeCopy($MergeID, 'Conversation', 'InsertUserID', $OldUserID, $NewUserID);
      $this->MergeCopy($MergeID, 'ConversationMessage', 'InsertUserID', $OldUserID, $NewUserID, 'MessageID');
      $this->MergeCopy($MergeID, 'UserConversation', 'UserID', $OldUserID, $NewUserID, 'ConversationID');
      
      $this->MergeFinish($MergeID);
      
      $OldUser = $this->GetID($OldUserID, DATASET_TYPE_ARRAY);
      $NewUser = $this->GetID($NewUserID, DATASET_TYPE_ARRAY);
      
      $Result['MergeID'] = $MergeID;
      $Result['After'] = array(
         'OldUser' => ArrayTranslate($OldUser, $Map),
         'NewUser' => ArrayTranslate($NewUser, $Map));
      
      return $Result;
   }
551786
@SuppressWarnings({ "unused", "unchecked" })
  private static void rewriteMergeData(String key, String subKey,
      NamedList<Object> snl, NamedList<Object> tnl) {
    if (snl != null) {
      Object o = tnl.get(key);
      NamedList<Object> tnnnl;
      if (o != null && o instanceof NamedList) {
        tnnnl = (NamedList<Object>) o;
      } else {
        tnnnl = new SimpleOrderedMap<>();
        tnl.add(key, tnnnl);
      }
      tnnnl.add(subKey, snl);
    }
  }
841882
@Override
    public Set<String> mergePossibleUserAttributeNames(final Set<String> toModify, final Set<String> toConsider) {
        toModify.addAll(toConsider);
        return toModify;
    }
410116
public ApiResponse addUserToGroup(String userId, String groupId) {
        return apiRequest(HttpMethod.POST, null, null, organizationId,  applicationId, "groups",
                groupId, "users", userId);
    }
1314518
public static DataSource createDataSource(String source, String type, String... configs){
		String config = StringUtils.join(configs, " ");
		return createDataSource(source, type, config);
	}