/*
 * Copyright by the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.bitcoinj.utils;

import org.bitcoinj.core.NetworkParameters;

/**
 * A convenient {@code enum} representation of a network.
 */
public enum Network {
    MAIN(NetworkParameters.ID_MAINNET),
    TEST(NetworkParameters.ID_TESTNET),
    SIGNET(NetworkParameters.ID_SIGNET),
    REGTEST(NetworkParameters.ID_REGTEST);

    private final String id;

    Network(String networkId) {
        id = networkId;
    }

    /**
     * Get the network id string as specified in {@link NetworkParameters}
     *
     * @return The network id string
     */
    public String id() {
        return id;
    }

    /**
     * Get the associated {@link NetworkParameters}
     *
     * @return The network parameters
     */
    public NetworkParameters networkParameters() {
        return NetworkParameters.fromID(id);
    }
}

@@ -1426,11 +1426,1114 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Get the correct enum for a NetworkParameters%0A     * Note: UNITTEST is not supported as an enum%0A     * @param networkParameters specifies the network%0A     * @return the enum%0A     */%0A    public static Network of(NetworkParameters networkParameters) %7B%0A        return of(networkParameters.getId());%0A    %7D%0A%0A    /**%0A     * Get the correct enum for a network id string%0A     * Note: UNITTEST is not supported as an enum%0A     * @param idString specifies the network%0A     * @return the enum%0A     */%0A    public static Network of(String idString) %7B%0A        switch (idString) %7B%0A            case NetworkParameters.ID_MAINNET:%0A                return MAIN;%0A            case NetworkParameters.ID_TESTNET:%0A                return TEST;%0A            case NetworkParameters.ID_SIGNET:%0A                return SIGNET;%0A            case NetworkParameters.ID_REGTEST:%0A                return REGTEST;%0A            case NetworkParameters.ID_UNITTESTNET:%0A                return REGTEST;%0A            default:%0A                throw new IllegalArgumentException(%22Illegal NetworkParameters: %22 + idString);%0A        %7D%0A    %7D
 %0A%7D%0A

add two more static constructors for convenience