Unmerges one network configuration from another.

@param base The base network configuration.
@param unmerge The configuration to extract.
@return The cleaned configuration.
333533
public static NetworkConfig unmergeNetworks(NetworkConfig base, NetworkConfig unmerge) {
    if (!base.getName().equals(unmerge.getName())) {
      throw new IllegalArgumentException("Cannot merge networks of different names.");
    }

    for (ComponentConfig<?> component : unmerge.getComponents()) {
      base.removeComponent(component.getName());
    }

    for (ConnectionConfig connection : unmerge.getConnections()) {
      base.destroyConnection(connection);
    }
    return base;
  }
480819
public org.inferred.freebuilder.processor.property.Property.Builder mergeFrom(
      org.inferred.freebuilder.processor.property.Property.Builder template) {
    // Upcast to access private fields; otherwise, oddly, we get an access violation.
    Property_Builder base = template;
    Property_Builder defaults = new org.inferred.freebuilder.processor.property.Property.Builder();
    if (!base._unsetProperties.contains(Property.TYPE)
        && (defaults._unsetProperties.contains(Property.TYPE)
            || !Objects.equals(template.getType(), defaults.getType()))) {
      setType(template.getType());
    }
    template.getBoxedType().ifPresent(this::setBoxedType);
    if (!base._unsetProperties.contains(Property.NAME)
        && (defaults._unsetProperties.contains(Property.NAME)
            || !Objects.equals(template.getName(), defaults.getName()))) {
      setName(template.getName());
    }
    if (!base._unsetProperties.contains(Property.CAPITALIZED_NAME)
        && (defaults._unsetProperties.contains(Property.CAPITALIZED_NAME)
            || !Objects.equals(template.getCapitalizedName(), defaults.getCapitalizedName()))) {
      setCapitalizedName(template.getCapitalizedName());
    }
    if (!base._unsetProperties.contains(Property.ALL_CAPS_NAME)
        && (defaults._unsetProperties.contains(Property.ALL_CAPS_NAME)
            || !Objects.equals(template.getAllCapsName(), defaults.getAllCapsName()))) {
      setAllCapsName(template.getAllCapsName());
    }
    if (!base._unsetProperties.contains(Property.USING_BEAN_CONVENTION)
        && (defaults._unsetProperties.contains(Property.USING_BEAN_CONVENTION)
            || template.isUsingBeanConvention() != defaults.isUsingBeanConvention())) {
      setUsingBeanConvention(template.isUsingBeanConvention());
    }
    if (!base._unsetProperties.contains(Property.GETTER_NAME)
        && (defaults._unsetProperties.contains(Property.GETTER_NAME)
            || !Objects.equals(template.getGetterName(), defaults.getGetterName()))) {
      setGetterName(template.getGetterName());
    }
    if (!base._unsetProperties.contains(Property.FULLY_CHECKED_CAST)
        && (defaults._unsetProperties.contains(Property.FULLY_CHECKED_CAST)
            || template.isFullyCheckedCast() != defaults.isFullyCheckedCast())) {
      setFullyCheckedCast(template.isFullyCheckedCast());
    }
    addAllAccessorAnnotations(base.accessorAnnotations);
    return (org.inferred.freebuilder.processor.property.Property.Builder) this;
  }
86426
function cleanJoin(req) {
  if(!isAbsoluteURL(req.url) && req.baseURL) {
    const parsedBase = url.parse(req.baseURL, true);
    const parsed = url.parse(req.url, true);
    return {
      protocol: parsedBase.protocol,
      host: parsedBase.hostname,
      port: parsedBase.port,
      path: URLJoin(parsedBase.pathname, parsed.pathname),
      query: mergeObjects(req._query, parsedBase.query, parsed.query)
    };
  } else {
    const parsed = url.parse(req.url, true);
    return {
      protocol: parsed.protocol,
      host: parsed.hostname,
      port: parsed.port,
      path: parsed.pathname,
      query: mergeObjects(req._query, parsed.query)
    };
  }
}
542031
public static OrganizationBean unmarshallOrganization(Map<String, Object> source) {
        if (source == null) {
            return null;
        }
        OrganizationBean bean = new OrganizationBean();
        bean.setId(asString(source.get("id")));
        bean.setName(asString(source.get("name")));
        bean.setDescription(asString(source.get("description")));
        bean.setCreatedOn(asDate(source.get("createdOn")));
        bean.setCreatedBy(asString(source.get("createdBy")));
        bean.setModifiedOn(asDate(source.get("modifiedOn")));
        bean.setModifiedBy(asString(source.get("modifiedBy")));
        postMarshall(bean);
        return bean;
    }
719529
@Nullable
  public static Metadata merge(
      @Nullable List<Metadata> toBeMerged,
      @Nullable AggregatorFactory[] overrideMergedAggregators
  )
  {
    if (toBeMerged == null || toBeMerged.size() == 0) {
      return null;
    }

    boolean foundSomeMetadata = false;
    Map<String, Object> mergedContainer = new HashMap<>();
    List<AggregatorFactory[]> aggregatorsToMerge = overrideMergedAggregators == null
                                                   ? new ArrayList<>()
                                                   : null;

    List<TimestampSpec> timestampSpecsToMerge = new ArrayList<>();
    List<Granularity> gransToMerge = new ArrayList<>();
    List<Boolean> rollupToMerge = new ArrayList<>();

    for (Metadata metadata : toBeMerged) {
      if (metadata != null) {
        foundSomeMetadata = true;
        if (aggregatorsToMerge != null) {
          aggregatorsToMerge.add(metadata.getAggregators());
        }

        if (timestampSpecsToMerge != null && metadata.getTimestampSpec() != null) {
          timestampSpecsToMerge.add(metadata.getTimestampSpec());
        }

        if (gransToMerge != null) {
          gransToMerge.add(metadata.getQueryGranularity());
        }

        if (rollupToMerge != null) {
          rollupToMerge.add(metadata.isRollup());
        }
        mergedContainer.putAll(metadata.container);
      } else {
        //if metadata and hence aggregators and queryGranularity for some segment being merged are unknown then
        //final merged segment should not have same in metadata
        aggregatorsToMerge = null;
        timestampSpecsToMerge = null;
        gransToMerge = null;
        rollupToMerge = null;
      }
    }

    if (!foundSomeMetadata) {
      return null;
    }

    final AggregatorFactory[] mergedAggregators = aggregatorsToMerge == null ?
                                                  overrideMergedAggregators :
                                                  AggregatorFactory.mergeAggregators(aggregatorsToMerge);

    final TimestampSpec mergedTimestampSpec = timestampSpecsToMerge == null ?
                                              null :
                                              TimestampSpec.mergeTimestampSpec(timestampSpecsToMerge);

    final Granularity mergedGranularity = gransToMerge == null ?
                                          null :
                                          Granularity.mergeGranularities(gransToMerge);

    Boolean rollup = null;
    if (rollupToMerge != null && !rollupToMerge.isEmpty()) {
      rollup = rollupToMerge.get(0);
      for (Boolean r : rollupToMerge) {
        if (r == null) {
          rollup = null;
          break;
        } else if (!r.equals(rollup)) {
          rollup = null;
          break;
        } else {
          rollup = r;
        }
      }
    }

    return new Metadata(
        mergedContainer,
        mergedAggregators,
        mergedTimestampSpec,
        mergedGranularity,
        rollup
    );
  }
1185084
public static boolean copyMerge(FileSystem srcFS, Path srcDir, 
                                  FileSystem dstFS, Path dstFile, 
                                  boolean deleteSource,
                                  Configuration conf, String addString) throws IOException {
    dstFile = checkDest(srcDir.getName(), dstFS, dstFile, false);

    if (!srcFS.getFileStatus(srcDir).isDir())
      return false;
   
    OutputStream out = dstFS.create(dstFile);
    
    try {
      FileStatus contents[] = srcFS.listStatus(srcDir);
      for (int i = 0; i < contents.length; i++) {
        if (!contents[i].isDir()) {
          InputStream in = srcFS.open(contents[i].getPath());
          try {
            IOUtils.copyBytes(in, out, conf, false);
            if (addString!=null)
              out.write(addString.getBytes("UTF-8"));

          } finally {
            in.close();
          }
        }
      }
    } finally {
      out.close();
    }


    if (deleteSource) {
      return srcFS.delete(srcDir, true);
    } else {
      return true;
    }
  }
207238
function mergeOptions(base, custom) {
  return Object.assign({}, defaultOptions, base, custom, {
    udpServer: Object.assign({}, defaultOptions.udpServer, base.udpServer, custom.udpServer),
    udpClient: Object.assign({}, defaultOptions.udpClient, base.udpClient, custom.udpClient),
    wsServer: Object.assign({}, defaultOptions.wsServer, base.wsServer, custom.wsServer),
  })
}
492177
public static DeploymentEntry merge(DeploymentEntry deployment1, DeploymentEntry deployment2) {
		final Map<String, String> mergedProperties = new HashMap<>(deployment1.asMap());
		mergedProperties.putAll(deployment2.asMap());

		final DescriptorProperties properties = new DescriptorProperties(true);
		properties.putProperties(mergedProperties);

		return new DeploymentEntry(properties);
	}
897648
public void merge(StandaloneConfiguration other) {
    if (other == null) {
      return;
    }

    if (isMergeAble(Integer.class, other.browserTimeout, browserTimeout)) {
      browserTimeout = other.browserTimeout;
    }
    if (isMergeAble(Integer.class, other.jettyMaxThreads, jettyMaxThreads)) {
      jettyMaxThreads = other.jettyMaxThreads;
    }
    if (isMergeAble(Integer.class, other.timeout, timeout)) {
      timeout = other.timeout;
    }
    // role, host, port, log, debug, version, enablePassThrough, and help are not merged,
    // they are only consumed by the immediately running process and should never affect a remote
  }
333504
public Attribute merge(List<AgBuffer> copyBuffers, int symbol, Type mergedType) {
        Map<Attribute, Merger> mapping;    // map old attribute to merger objects. null: don't merge.
        List<Merger> mergers;
        Merger merger;
        int i;
        int max;

        mapping = new HashMap<Attribute, Merger>();
        mergers = new ArrayList<Merger>();
        max = copyBuffers.size();
        for (i = 0; i < max; i++) {
            copyBuffers.get(i).createMergers(mergers, mapping, mergedType);
        }
        runMergers(mergers, mapping);
        merger = Merger.forSymbol(mergers, symbol);
        if (merger == null) {
            throw new IllegalStateException();
        }
        return merger.dest;
    }
1357638
protected Configurations merge(Configurations other) {
		Set<Class<?>> mergedClasses = new LinkedHashSet<>(getClasses());
		mergedClasses.addAll(other.getClasses());
		return merge(mergedClasses);
	}
723582
private Ringbuffer<Object> merge(RingbufferContainer<Object, Object> existingContainer, RingbufferMergeTypes mergingValue) {
        RingbufferMergeTypes existingValue = createMergingValueOrNull(existingContainer);

        RingbufferMergeData resultData = mergePolicy.merge(mergingValue, existingValue);

        if (resultData == null) {
            ringbufferService.destroyDistributedObject(namespace.getObjectName());
            return null;
        } else {
            if (existingContainer == null) {
                RingbufferConfig config = getRingbufferConfig(ringbufferService, namespace);
                existingContainer = ringbufferService.getOrCreateContainer(getPartitionId(), namespace, config);
            }
            setRingbufferData(resultData, existingContainer);
            return existingContainer.getRingbuffer();
        }
    }
1328593
public final UnresolvedReferenceExpression[] mergeOperands() {
		UnresolvedReferenceExpression[] aggBuffers = aggBufferAttributes();
		UnresolvedReferenceExpression[] ret = new UnresolvedReferenceExpression[aggBuffers.length];
		for (int i = 0; i < aggBuffers.length; i++) {
			String name = String.valueOf(i);
			validateOperandName(name);
			ret[i] = new UnresolvedReferenceExpression(name);
		}
		return ret;
	}
954615
function unmergeOne(ele) {
    ele = ele[0];
    var _p = this._private;
    var id = ele._private.data.id;
    var map = _p.map;
    var entry = map.get(id);

    if (!entry) {
      return this; // no need to remove
    }

    var i = entry.index;
    this.unmergeAt(i);
    return this;
  }
1186844
public Connector merge(Connector conn, Activation ij)
   {
      if (ij == null)
         return conn;

      //merge transactionSupport;
      mergeTransactionSupport(ij, conn);

      // merge RA onfigProperties;
      List<ConfigProperty> original = conn.getResourceadapter().getConfigProperties();
      List<ConfigProperty> newProperties = this.mergeConfigProperties(ij.getConfigProperties(), original);

      ((ResourceAdapterImpl) conn.getResourceadapter()).forceConfigProperties(newProperties);

      if (conn.getVersion() != Version.V_10)
      {
         //merge adminObjects;

         ResourceAdapter ra = conn.getResourceadapter();
         if (ra != null && ra.getAdminObjects() != null)
         {
            List<AdminObject> newAdminObjects = new ArrayList<AdminObject>(ra.getAdminObjects().size());
            for (AdminObject adminObj : ra.getAdminObjects())
            {
               AdminObject newAdminObj = adminObj;
               newAdminObjects.add(newAdminObj);
            }
            ((ResourceAdapterImpl) ra).forceAdminObjects(newAdminObjects);
         }
         //merge connectionDefinitions;
         if (ra != null && ra.getOutboundResourceadapter() != null &&
             ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
         {
            List<ConnectionDefinition> newConDefs = new ArrayList<ConnectionDefinition>(ra
               .getOutboundResourceadapter().getConnectionDefinitions().size());
            for (ConnectionDefinition conDef : ra.getOutboundResourceadapter().getConnectionDefinitions())
            {
               ConnectionDefinition newConDef = conDef;
               newConDefs.add(newConDef);
            }
            ((OutboundResourceAdapterImpl) ra.getOutboundResourceadapter())
               .forceConnectionDefinitions(newConDefs);
         }
      }

      return conn;
   }
1121532
public static String serializeMergeFields(Map<String, FieldType> mergeFields) throws HelloSignException {
        if (mergeFields == null || mergeFields.isEmpty()) {
            return null;
        }
        JSONArray mergeFieldArray = new JSONArray();
        for (String key : mergeFields.keySet()) {
            FieldType type = mergeFields.get(key);
            JSONObject mergeFieldObj = new JSONObject();
            try {
                mergeFieldObj.put("name", key);
                mergeFieldObj.put("type", type.toString());
            } catch (JSONException e) {
                throw new HelloSignException(e);
            }
            mergeFieldArray.put(mergeFieldObj);
        }
        return mergeFieldArray.toString();
    }
340648
public static boolean removeMergedRange(final Sheet sheet, final CellRangeAddress mergedRange) {
        ArgUtils.notNull(sheet, "sheet");
        ArgUtils.notNull(mergedRange, "mergedRange");

        final String mergedAddress = mergedRange.formatAsString(sheet.getSheetName(), true);

        final int num = sheet.getNumMergedRegions();
        for(int i=0; i < num; i ++) {
            final CellRangeAddress range = sheet.getMergedRegion(i);
            final String rangeAddress = range.formatAsString(sheet.getSheetName(), true);
            if(rangeAddress.equals(mergedAddress)) {
                sheet.removeMergedRegion(i);
                return true;
            }
        }

        return false;
    }