/*
Merge a CLDR delta file and a CLDR fallback file.

Note: the contract of this method reg. null values differs from both,
jQuery.extend as well as jQuery.sap.extend.
166490
function merge(obj, fallbackObj) {
			var name, value, fallbackValue;

			if ( !fallbackObj ) {
				return;
			}

			for ( name in fallbackObj ) {

				if ( fallbackObj.hasOwnProperty(name) ) {

					value = obj[ name ];
					fallbackValue = fallbackObj[ name ];

					if ( value === undefined ) {
						// 'undefined': value doesn't exist in delta, so take it from the fallback object
						// Note: undefined is not a valid value in JSON, so we can't misunderstand an existing undefined
						obj[name] = fallbackValue;
					} else if ( value === null ) {
						// 'null' is used by the delta tooling as a marker that a value must not be taken form the fallback
						delete obj[name];
					} else if ( typeof value === 'object' && typeof fallbackValue === 'object' ) {
						// both values are objects, merge them recursively
						merge(value, fallbackValue);
					}

				}

			}

		}
137208
public static LofDataSet mergeDataSet(LofDataSet baseDataSet, LofDataSet targetDataSet, int max)
    {
        Collection<LofPoint> basePointList = baseDataSet.getDataMap().values();
        Collection<LofPoint> targetPointList = targetDataSet.getDataMap().values();

        // LOFの対象点を時刻でソートしたリストを生成する。
        List<LofPoint> mergedList = new ArrayList<>();
        mergedList.addAll(basePointList);
        mergedList.addAll(targetPointList);
        Collections.sort(mergedList, new LofPointComparator());

        // ソート後、新しい方から扱うため順番を逆にする。
        Collections.reverse(mergedList);

        // 新しいデータから順にマージ後のモデルに反映する。
        // 但し、お互いに非同期でマージが行われるため同様のIDを持つデータが複数存在するケースがある。
        // そのため、IDを比較してそれまでに取得していないデータの追加のみを行う。
        Set<String> registeredId = new HashSet<>();
        int addedCount = 0;
        LofDataSet resultDataSet = new LofDataSet();

        for (LofPoint targetPoint : mergedList)
        {
            if (registeredId.contains(targetPoint.getDataId()) == true)
            {
                continue;
            }

            registeredId.add(targetPoint.getDataId());
            resultDataSet.addData(targetPoint);
            addedCount++;

            if (addedCount >= max)
            {
                break;
            }
        }

        return resultDataSet;
    }
1292909
synchronized void mergeRollback(Row row) {

        RowActionBase action = this;
        RowActionBase head   = null;
        RowActionBase tail   = null;

        if (type == RowActionBase.ACTION_DELETE_FINAL
                || type == RowActionBase.ACTION_NONE) {
            return;
        }

        do {
            if (action.rolledback) {
                if (tail != null) {
                    tail.next = null;
                }
            } else {
                if (head == null) {
                    head = tail = action;
                } else {
                    tail.next = action;
                    tail      = action;
                }
            }

            action = action.next;
        } while (action != null);

        if (head == null) {
            boolean exists = (type == RowActionBase.ACTION_DELETE);

            if (exists) {
                setAsNoOp(row);
            } else {
                setAsDeleteFinal();
            }
        } else {
            if (head != this) {
                setAsAction(head);
            }
        }
    }
258024
function mergeOne(dst, src) {
  if (src === undefined) return dst;

  // According to specification arrays must be concatenated.
  // Also, the '.concat' creates a new array instance. Overrides the 'dst'.
  if (isArray(src)) return (isArray(dst) ? dst : []).concat(src);

  // Now deal with non plain 'src' object. 'src' overrides 'dst'
  // Note that functions are also assigned! We do not deep merge functions.
  if (!isPlainObject(src)) return src;

  // See if 'dst' is allowed to be mutated.
  // If not - it's overridden with a new plain object.
  var returnValue = isObject(dst) ? dst : {};

  var keys = Object.keys(src);
  for (var i = 0; i < keys.length; i += 1) {
    var key = keys[i];

    var srcValue = src[key];
    // Do not merge properties with the 'undefined' value.
    if (srcValue !== undefined) {
      var dstValue = returnValue[key];
      // Recursive calls to mergeOne() must allow only plain objects or arrays in dst
      var newDst = isPlainObject(dstValue) || isArray(srcValue) ? dstValue : {};

      // deep merge each property. Recursion!
      returnValue[key] = mergeOne(newDst, srcValue);
    }
  }

  return returnValue;
}
425470
def extendMarkdown(self, md, md_globals=None):
        """"""
        if any(
                x not in md.treeprocessors
                for x in self.REQUIRED_EXTENSION_INTERNAL_NAMES):
            raise RuntimeError(
                "The attr_cols markdown extension depends the following"
                " extensions which must preceded it in the extension"
                " list: %s" % ", ".join(self.REQUIRED_EXTENSIONS))
        processor = AttrColTreeProcessor(md, self.conf)
        md.treeprocessors.register(
            processor, 'attr_cols',
            5)
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;
    }
227465
private void mergeValuesLength(int begin, int end) {
    if (begin < end) {
      int bValue = toIntUnsigned(getValue(begin));
      int eValue = toIntUnsigned(getValue(end));
      int eLength = toIntUnsigned(getLength(end));
      int newLength = eValue - bValue + eLength;
      setLength(begin, (short) newLength);
      recoverRoomsInRange(begin, end);
    }
  }
1260205
function _from_dir (opts, cfg_so_far, cb) { 
  var cfg = {};
  var file_root_dir_tmpl = (opts && opts.files) || __dirname + '/etc';
  
  var vals = {
    env: process.env.NODE_ENV || 'development'
  };

  _.merge (vals, cfg_so_far);
  
  var file_root_dir = interpolator.parse (file_root_dir_tmpl, vals);

  klaw (file_root_dir, {})
  .on('data', function(item){
    if (item.stats.isFile() && isCfg (item.path)) {
      var pat = item.path
        .substr (file_root_dir.length + 1)
        .substr (0, item.path.length - (file_root_dir.length + 1) - (path.extname (item.path).length))
        .replace (/\./g, '_')
        .replace (/\//g, '.');

      var item_cfg = {};
      _.set (item_cfg, pat, importFresh (item.path));
      _.merge (cfg, item_cfg);
    }
  })
  .on ('error', function (err) {
    if ((err.code === 'ENOENT') && (err.path === file_root_dir)) {
      // ignore

      // expand variables in loaded object
      _expand (cfg, vals, cb);
    }
    else {
      console.error ('got error reading recursive config from %s: ', file_root_dir, err);
      return cb (err);
    }
  })
  .on('end', function () {
    // expand variables in loaded object
    _expand (cfg, vals, cb);
  });
}
328743
private void appendNullCriteria(TableAlias alias, PathInfo pathInfo, NullCriteria c, StringBuffer buf)
    {
        appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
        buf.append(c.getClause());
    }
641214
function createparams (filename, fallback) {
  if (filename === undefined) {
    return
  }

  var params = {}

  if (typeof filename !== 'string') {
    throw new TypeError('filename must be a string')
  }

  // fallback defaults to true
  if (fallback === undefined) {
    fallback = true
  }

  if (typeof fallback !== 'string' && typeof fallback !== 'boolean') {
    throw new TypeError('fallback must be a string or boolean')
  }

  if (typeof fallback === 'string' && NON_LATIN1_REGEXP.test(fallback)) {
    throw new TypeError('fallback must be ISO-8859-1 string')
  }

  // restrict to file base name
  var name = basename(filename)

  // determine if name is suitable for quoted string
  var isQuotedString = TEXT_REGEXP.test(name)

  // generate fallback name
  var fallbackName = typeof fallback !== 'string'
    ? fallback && getlatin1(name)
    : basename(fallback)
  var hasFallback = typeof fallbackName === 'string' && fallbackName !== name

  // set extended filename parameter
  if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) {
    params['filename*'] = name
  }

  // set filename parameter
  if (isQuotedString || hasFallback) {
    params.filename = hasFallback
      ? fallbackName
      : name
  }

  return params
}
162831
function(delta){
      events.childNodesModified.call(this, delta);

      var array;
      if (array = delta.inserted)
      {
        for (var i = 0, child; child = array[i++];)
        {
          child.groupId_ = child.delegate ? child.delegate.basisObjectId : child.data.id;
          this.map_[child.groupId_] = child;
        }

        if (this.dataSource && this.nullGroup.first)
        {
          var parentNode = this.owner;
          var nodes = arrayFrom(this.nullGroup.nodes); // basis.array.from, because nullGroup.nodes may be transformed
          for (var i = nodes.length; i-- > 0;)
            parentNode.insertBefore(nodes[i], nodes[i].nextSibling);
        }
      }
    }
243675
function mergeFixes(fixes, sourceCode) {
    if (fixes.length === 0) {
        return null;
    }
    if (fixes.length === 1) {
        return fixes[0];
    }

    fixes.sort(compareFixesByRange);

    const originalText = sourceCode.text;
    const start = fixes[0].range[0];
    const end = fixes[fixes.length - 1].range[1];
    let text = "";
    let lastPos = Number.MIN_SAFE_INTEGER;

    for (const fix of fixes) {
        assert(fix.range[0] >= lastPos, "Fix objects must not be overlapped in a report.");

        if (fix.range[0] >= 0) {
            text += originalText.slice(Math.max(0, start, lastPos), fix.range[0]);
        }
        text += fix.text;
        lastPos = fix.range[1];
    }
    text += originalText.slice(Math.max(0, start, lastPos), end);

    return { range: [start, end], text };
}
676437
function getMergedDependency( projectData, abspath, options ) {
    var calc_deps = [];
    var fileDeps = projectData.dependency[abspath];
    if ( !fileDeps ) { return calc_deps; }

    fileDeps.forEach(function( a_dep_id ){

      // User specified a function to resolve the id to a file path
      if ( typeof options.resolveID == "function" ) {
        var newPath = options.resolveID( a_dep_id );
        if ( newPath ) {
          this.push( newPath );
          return;
        }
      }

      // Use default logic to resolve the id to a file,
      // When user does nothing for the id.
      var dep_abs_path   = projectData.id2File[ a_dep_id ];
      var dep_merge      = projectData.dep_merge;
      var dep_merge_path = dep_merge[ dep_abs_path ];

      if ( dep_merge_path ) {
        if ( dep_merge_path != dep_merge[ abspath ] ) {
          // Use the merged file path, if current file and dependency won't merge into the same file
          dep_abs_path = dep_merge_path;
        } else {
          // Dependency and current file will merge into one file.
          // Dependency will come first, so no need to specify dependency.
          return;
        }
      } 

      this.push( dep_abs_path ? resolveToBase( dep_abs_path, options.seajsBasePath ) : a_dep_id );

    }, calc_deps);

    return dereplicate( calc_deps );
  }
654099
protected final boolean mergeLists(List<UnclosedBranchDescriptor> child1open,
										List<UnclosedBranchDescriptor> child2open,
										List<UnclosedBranchDescriptor> result,
										boolean markJoinedBranchesAsPipelineBreaking) {

		//remove branches which have already been closed
		removeClosedBranches(child1open);
		removeClosedBranches(child2open);
		
		result.clear();
		
		// check how many open branches we have. the cases:
		// 1) if both are null or empty, the result is null
		// 2) if one side is null (or empty), the result is the other side.
		// 3) both are set, then we need to merge.
		if (child1open == null || child1open.isEmpty()) {
			if(child2open != null && !child2open.isEmpty()) {
				result.addAll(child2open);
			}
			return false;
		}
		
		if (child2open == null || child2open.isEmpty()) {
			result.addAll(child1open);
			return false;
		}

		int index1 = child1open.size() - 1;
		int index2 = child2open.size() - 1;
		
		boolean didCloseABranch = false;

		// as both lists (child1open and child2open) are sorted in ascending ID order
		// we can do a merge-join-like loop which preserved the order in the result list
		// and eliminates duplicates
		while (index1 >= 0 || index2 >= 0) {
			int id1 = -1;
			int id2 = index2 >= 0 ? child2open.get(index2).getBranchingNode().getId() : -1;

			while (index1 >= 0 && (id1 = child1open.get(index1).getBranchingNode().getId()) > id2) {
				result.add(child1open.get(index1));
				index1--;
			}
			while (index2 >= 0 && (id2 = child2open.get(index2).getBranchingNode().getId()) > id1) {
				result.add(child2open.get(index2));
				index2--;
			}

			// match: they share a common branching child
			if (id1 == id2) {
				didCloseABranch = true;
				
				// if this is the latest common child, remember it
				OptimizerNode currBanchingNode = child1open.get(index1).getBranchingNode();
				
				long vector1 = child1open.get(index1).getJoinedPathsVector();
				long vector2 = child2open.get(index2).getJoinedPathsVector();
				
				// check if this is the same descriptor, (meaning that it contains the same paths)
				// if it is the same, add it only once, otherwise process the join of the paths
				if (vector1 == vector2) {
					result.add(child1open.get(index1));
				}
				else {
					// we merge (re-join) a branch

					// mark the branch as a point where we break the pipeline
					if (markJoinedBranchesAsPipelineBreaking) {
						currBanchingNode.markAllOutgoingConnectionsAsPipelineBreaking();
					}

					if (this.hereJoinedBranches == null) {
						this.hereJoinedBranches = new ArrayList<OptimizerNode>(2);
					}
					this.hereJoinedBranches.add(currBanchingNode);

					// see, if this node closes the branch
					long joinedInputs = vector1 | vector2;

					// this is 2^size - 1, which is all bits set at positions 0..size-1
					long allInputs = (0x1L << currBanchingNode.getOutgoingConnections().size()) - 1;

					if (joinedInputs == allInputs) {
						// closed - we can remove it from the stack
						addClosedBranch(currBanchingNode);
					} else {
						// not quite closed
						result.add(new UnclosedBranchDescriptor(currBanchingNode, joinedInputs));
					}
				}

				index1--;
				index2--;
			}
		}

		// merged. now we need to reverse the list, because we added the elements in reverse order
		Collections.reverse(result);
		return didCloseABranch;
	}
1345940
function readAndMergeFiles(files, cb) {
    assert.func(cb);
    if ((typeof (files)) === 'string') {
        files = [ files ];
    }
    assert.arrayOfString(files, 'files');
    var objs = [];
    function end() {
        cb(null, merge.apply(this, objs));
    }
    var i = 0;
    function next() {
        var file = files[i];
        if (!file) {
            end();
            return;
        }

        fs.stat(file, function (statErr, stat) {
            if (statErr && statErr.code === 'ENOENT' && i != 0) {
                ++i;
                next();
                return;
            }
            if (statErr) {
                cb(statErr);
                return;
            }

            readJsonFile(file, function (readErr, s) {
                if (readErr) {
                    cb(readErr);
                    return;
                }
                objs.push(s);
                ++i;
                next();
            });
        });
    }
    next();
}
153331
function merge( elem, callback ) {
		var old = find( destChildren, elem.name ),
			nl;

		// merge with old element
		if ( old ) {
			if ( typeof callback == 'function' ) {
				return callback( old );
			}

			_.merge( old.attribs, elem.attribs );

			if ( elem.children ) {
				combine( old, elem );
			}
			// append new element
		} else {
			if ( dest.children ) {
				utils.appendChild( dest, elem );
			} else {
				utils.prepend( destChildren[ 0 ], elem );
				// fix for domutils issue
				elem.parent = destChildren[ 0 ].parent;
				destChildren.unshift( elem );
				destChildren.splice( destChildren.indexOf( elem ) + 1, 0, nl );
			}
		}
	}
131364
function fallBack () {
      var programFilesVar = "ProgramFiles";
      if (arch === "(64)") {
        console.warn("You are using 32-bit version of Firefox on 64-bit versions of the Windows.\nSome features may not work correctly in this version. You should upgrade Firefox to the latest 64-bit version now!")
        programFilesVar = "ProgramFiles(x86)";
      }
      resolve(path.join(process.env[programFilesVar], appName, "firefox.exe"));
    }