Combine two trees into a new tree.

@param x
the first tree
@param y
the second tree
@return the combined tree
195713
private TreeNode<K> combine(TreeNode<K> x, TreeNode<K> y) {
        TreeNode<K> z = new TreeNode<K>();
        z.left = x;
        z.right = y;
        z.rank = x.rank + 1;
        sift(z);
        return z;
    }
1258424
public Vector4d add(double x, double y, double z, double w) {
        return add(x, y, z, w, thisOrNew());
    }
286022
@SuppressWarnings({"unchecked", "rawtypes"})
    private InternalNode<?> combineIDDSameLevel(InternalNode n1,
                                                InternalNode n2) throws MIDDException {
        if (n1.getID() != n2.getID()) {
            throw new IllegalArgumentException("Both params should have the same variable level at their root");
        }

        if (n1.getType() != n2.getType()) {
            throw new IllegalArgumentException("Both IDD roots should have the same data type");
        }

        Partition p1 = PartitionBuilder.createPartition(n1.getIntervals());
        Partition p2 = PartitionBuilder.createPartition(n2.getIntervals());

        Partition<?> p = PartitionBuilder.union(p1, p2);
        if (p.size() == 0) {
            log.error("Empty unioned partition");
            return null;
        }

        InternalNodeState newState = combineIndeterminateStates(n1.getState(), n2.getState());

        InternalNode<?> n = NodeUtils.createInternalNode(n1.getID(), newState, n1.getType());

        for (Interval<?> interval : p.getIntervals()) {
            AbstractNode op1 = n1.getChild(interval);
            AbstractNode op2 = n2.getChild(interval);
            AbstractNode child = null;
            if (op1 != null && op2 != null) {
                child = combine(op1, op2);
            } else if (op1 != null || op2 != null) {
                child = GenericUtils.newInstance(op1 == null ? op2 : op1);
            } else {
                throw new RuntimeException("Error merging two partitions, " +
                        "the output partition has an item not belong to both previous ones");
            }

            if (child != null) {
                AbstractEdge<?> edge = EdgeUtils.createEdge(interval, n.getType());
                if (edge.getIntervals().size() == 0) {
                    throw new RuntimeException("Empty edge");
                }
                n.addChild(edge, child);
            }
        }

        return n;
    }
1082462
public void add(double x, double y) {
    data.add(x);
    data.add(y);
    minx = Math.min(minx, x);
    maxx = Math.max(maxx, x);
    miny = Math.min(miny, y);
    maxy = Math.max(maxy, y);
  }
234140
public int addPoint(double x, double y) {
		int pointIndex;

		if (this.pointCoordinates == null) {
			this.pointCoordinates = new double[] {x, y};
			this.partIndexes = null;
			pointIndex = 0;
		} else {
			double[] pts = new double[this.pointCoordinates.length + 2];
			System.arraycopy(this.pointCoordinates, 0, pts, 0, this.pointCoordinates.length);
			pointIndex = pts.length - 2;
			pts[pointIndex] = x;
			pts[pointIndex + 1] = y;
			this.pointCoordinates = pts;
			pts = null;

			pointIndex /= 2;
		}

		fireShapeChanged();
		fireElementChanged();

		return pointIndex;
	}
884382
public void mergeNE(double x, double y) {
		if (xmin > x)
			xmin = x;
		else if (xmax < x)
			xmax = x;

		if (ymin > y)
			ymin = y;
		else if (ymax < y)
			ymax = y;
	}
681625
private ExternalNode3 combineExternalNodes(ExternalNode3 n1, ExternalNode3 n2) {
        if (n1 == null || n2 == null) {
            throw new IllegalArgumentException("Input nodes must not be null");
        }

        DecisionType combinedDecision = algo.combine(n1.getDecision(), n2.getDecision());
        ExternalNode3 n = new ExternalNode3(combinedDecision);

        // only accept OE that match with combined decision.

        List<ObligationExpression> oes1 = getFulfilledObligationExpressions(n1.getObligationExpressions(), combinedDecision);
        List<ObligationExpression> oes2 = getFulfilledObligationExpressions(n2.getObligationExpressions(), combinedDecision);

        n.getObligationExpressions().addAll(oes1);
        n.getObligationExpressions().addAll(oes2);

        return n;
    }
731904
public V merge(V a, V b) {
        final V aHead = componentOf(a);
        final V bHead = componentOf(b);
        if (aHead.equals(bHead)) return aHead;
        // add the shorter tree underneath the taller tree
        final int aRank = ranks.getOrDefault(aHead, 0);
        final int bRank = ranks.getOrDefault(bHead, 0);
        if (aRank > bRank) {
            parents.put(bHead, aHead);
            return aHead;
        } else if (bRank > aRank) {
            parents.put(aHead, bHead);
            return bHead;
        } else {
            // whoops, the tree got taller
            parents.put(bHead, aHead);
            ranks.put(aHead, aRank + 1);
            return aHead;
        }
    }
727241
private Node<K, V> link(Node<K, V> y, Node<K, V> x) {
        y.parent = x;
        Node<K, V> child = x.child;
        if (child == null) {
            x.child = y;
            y.next = y;
            y.prev = y;
        } else {
            y.prev = child;
            y.next = child.next;
            child.next = y;
            y.next.prev = y;
        }
        return x;
    }
1364881
public final <T1, T2> Tuple2<T1, T2> concat(Tuple2<T1, T2> tuple) {
        return new Tuple2<>(tuple.v1, tuple.v2);
    }
1315858
def _merge(x, y):
    """"""
    merged = {**x, **y}

    xkeys = x.keys()

    for key in xkeys:
        if isinstance(x[key], dict) and key in y:
            merged[key] = _merge(x[key], y[key])

    return merged
555682
public Vector2i add(int x, int y, Vector2i dest) {
        dest.x = this.x + x;
        dest.y = this.y + y;
        return dest;
    }
242147
public final <T3, T4> Tuple4<T1, T2, T3, T4> concat(Tuple2<T3, T4> tuple) {
        return new Tuple4<>(v1, v2, tuple.v1, tuple.v2);
    }
470946
public static IntegerBinding addExact(final ObservableIntegerValue x, final ObservableIntegerValue y) {
        return createIntegerBinding(() -> Math.addExact(x.get(), y.get()), x, y);
    }
1088447
public static Taint merge(Taint a, Taint b) {
        if (a == null) {
            if (b == null) {
                return null;
            } else {
                return new Taint(b);
            }
        } else if (b == null) {
            return new Taint(a);
        }
        assert a != null && b != null;
        Taint result = new Taint(State.merge(a.getState(), b.getState()));
        if (a.variableIndex == b.variableIndex) {
            result.variableIndex = a.variableIndex;
        }
        result.taintLocations.addAll(a.taintLocations);
        result.taintLocations.addAll(b.taintLocations);
        result.unknownLocations.addAll(a.unknownLocations);
        result.unknownLocations.addAll(b.unknownLocations);
        if (!result.isTainted()) {
           mergeParameters(a, b, result); 
        }
        mergeRealInstanceClass(a, b, result);
        mergeTags(a, b, result);
        if (a.constantValue != null && a.constantValue.equals(b.constantValue)) {
            result.constantValue = a.constantValue;
        }
        if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) {
            result.setDebugInfo("[" + a.getDebugInfo() + "]+[" + b.getDebugInfo() + "]");
        }
        assert !result.hasParameters() || result.isUnknown();
        if(a.potentialValue != null) {
            result.potentialValue = a.potentialValue;
        }
        else if(b.potentialValue != null) {
            result.potentialValue = b.potentialValue;
        }
        result.addAllSources(a.sources);
        result.addAllSources(b.sources);
        return result;
    }
992101
def combine(*args):
    
    if hasattr(args, '__iter__') and (len(args) > 1):
        subtree = combine(*args[:-1])
        tree = []
        for leaf in subtree:
            for node in args[-1]:
                if hasattr(leaf, '__iter__'):
                    tree.append(leaf + [node])
                else:
                    tree.append([leaf] + [node])
        return tree
    else:
        return [[arg] for arg in args[0]]
895393
public void mergeSubtree(final OperationTransformerRegistry targetRegistry, final Map<PathAddress, ModelVersion> subTree) {
        for(Map.Entry<PathAddress, ModelVersion> entry: subTree.entrySet()) {
            mergeSubtree(targetRegistry, entry.getKey(), entry.getValue());
        }
    }