Esempio n. 1
0
  /**
   * Unmerges one network configuration from another.
   *
   * @param base The base network configuration.
   * @param unmerge The configuration to extract.
   * @return The cleaned configuration.
   */
  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;
  }