Replace map with a switch statement in bandwidth meter implementations

#minor-release

PiperOrigin-RevId: 407042882
This commit is contained in:
christosts 2021-11-02 10:49:18 +00:00 committed by Ian Baker
parent 686f2ca96d
commit 72f56760bb

View File

@ -30,10 +30,8 @@ import androidx.media3.datasource.TransferListener;
import androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener.EventDispatcher; import androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener.EventDispatcher;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -47,13 +45,6 @@ import java.util.Map;
@UnstableApi @UnstableApi
public final class DefaultBandwidthMeter implements BandwidthMeter, TransferListener { public final class DefaultBandwidthMeter implements BandwidthMeter, TransferListener {
/**
* Country groups used to determine the default initial bitrate estimate. The group assignment for
* each country is a list for [Wifi, 2G, 3G, 4G, 5G_NSA, 5G_SA].
*/
public static final ImmutableListMultimap<String, Integer>
DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS = createInitialBitrateCountryGroupAssignment();
/** Default initial Wifi bitrate estimate in bits per second. */ /** Default initial Wifi bitrate estimate in bits per second. */
public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI = public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI =
ImmutableList.of(5_400_000L, 3_300_000L, 2_000_000L, 1_300_000L, 760_000L); ImmutableList.of(5_400_000L, 3_300_000L, 2_000_000L, 1_300_000L, 760_000L);
@ -87,17 +78,35 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
/** Default maximum weight for the sliding window. */ /** Default maximum weight for the sliding window. */
public static final int DEFAULT_SLIDING_WINDOW_MAX_WEIGHT = 2000; public static final int DEFAULT_SLIDING_WINDOW_MAX_WEIGHT = 2000;
/** Index for the Wifi group index in {@link #DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS}. */ /**
* Index for the Wifi group index in the array returned by {@link
* #getInitialBitrateCountryGroupAssignment}.
*/
private static final int COUNTRY_GROUP_INDEX_WIFI = 0; private static final int COUNTRY_GROUP_INDEX_WIFI = 0;
/** Index for the 2G group index in {@link #DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS}. */ /**
* Index for the 2G group index in the array returned by {@link
* #getInitialBitrateCountryGroupAssignment}.
*/
private static final int COUNTRY_GROUP_INDEX_2G = 1; private static final int COUNTRY_GROUP_INDEX_2G = 1;
/** Index for the 3G group index in {@link #DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS}. */ /**
* Index for the 3G group index in the array returned by {@link
* #getInitialBitrateCountryGroupAssignment}.
*/
private static final int COUNTRY_GROUP_INDEX_3G = 2; private static final int COUNTRY_GROUP_INDEX_3G = 2;
/** Index for the 4G group index in {@link #DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS}. */ /**
* Index for the 4G group index in the array returned by {@link
* #getInitialBitrateCountryGroupAssignment}.
*/
private static final int COUNTRY_GROUP_INDEX_4G = 3; private static final int COUNTRY_GROUP_INDEX_4G = 3;
/** Index for the 5G-NSA group index in {@link #DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS}. */ /**
* Index for the 5G-NSA group index in the array returned by {@link
* #getInitialBitrateCountryGroupAssignment}.
*/
private static final int COUNTRY_GROUP_INDEX_5G_NSA = 4; private static final int COUNTRY_GROUP_INDEX_5G_NSA = 4;
/** Index for the 5G-SA group index in {@link #DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS}. */ /**
* Index for the 5G-SA group index in the array returned by {@link
* #getInitialBitrateCountryGroupAssignment}.
*/
private static final int COUNTRY_GROUP_INDEX_5G_SA = 5; private static final int COUNTRY_GROUP_INDEX_5G_SA = 5;
@Nullable private static DefaultBandwidthMeter singletonInstance; @Nullable private static DefaultBandwidthMeter singletonInstance;
@ -217,40 +226,33 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
} }
private static Map<Integer, Long> getInitialBitrateEstimatesForCountry(String countryCode) { private static Map<Integer, Long> getInitialBitrateEstimatesForCountry(String countryCode) {
List<Integer> groupIndices = getCountryGroupIndices(countryCode); int[] groupIndices = getInitialBitrateCountryGroupAssignment(countryCode);
Map<Integer, Long> result = new HashMap<>(/* initialCapacity= */ 8); Map<Integer, Long> result = new HashMap<>(/* initialCapacity= */ 8);
result.put(C.NETWORK_TYPE_UNKNOWN, DEFAULT_INITIAL_BITRATE_ESTIMATE); result.put(C.NETWORK_TYPE_UNKNOWN, DEFAULT_INITIAL_BITRATE_ESTIMATE);
result.put( result.put(
C.NETWORK_TYPE_WIFI, C.NETWORK_TYPE_WIFI,
DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI.get(groupIndices.get(COUNTRY_GROUP_INDEX_WIFI))); DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI.get(groupIndices[COUNTRY_GROUP_INDEX_WIFI]));
result.put( result.put(
C.NETWORK_TYPE_2G, C.NETWORK_TYPE_2G,
DEFAULT_INITIAL_BITRATE_ESTIMATES_2G.get(groupIndices.get(COUNTRY_GROUP_INDEX_2G))); DEFAULT_INITIAL_BITRATE_ESTIMATES_2G.get(groupIndices[COUNTRY_GROUP_INDEX_2G]));
result.put( result.put(
C.NETWORK_TYPE_3G, C.NETWORK_TYPE_3G,
DEFAULT_INITIAL_BITRATE_ESTIMATES_3G.get(groupIndices.get(COUNTRY_GROUP_INDEX_3G))); DEFAULT_INITIAL_BITRATE_ESTIMATES_3G.get(groupIndices[COUNTRY_GROUP_INDEX_3G]));
result.put( result.put(
C.NETWORK_TYPE_4G, C.NETWORK_TYPE_4G,
DEFAULT_INITIAL_BITRATE_ESTIMATES_4G.get(groupIndices.get(COUNTRY_GROUP_INDEX_4G))); DEFAULT_INITIAL_BITRATE_ESTIMATES_4G.get(groupIndices[COUNTRY_GROUP_INDEX_4G]));
result.put( result.put(
C.NETWORK_TYPE_5G_NSA, C.NETWORK_TYPE_5G_NSA,
DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA.get( DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA.get(groupIndices[COUNTRY_GROUP_INDEX_5G_NSA]));
groupIndices.get(COUNTRY_GROUP_INDEX_5G_NSA)));
result.put( result.put(
C.NETWORK_TYPE_5G_SA, C.NETWORK_TYPE_5G_SA,
DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA.get(groupIndices.get(COUNTRY_GROUP_INDEX_5G_SA))); DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA.get(groupIndices[COUNTRY_GROUP_INDEX_5G_SA]));
// Assume default Wifi speed for Ethernet to prevent using the slower fallback. // Assume default Wifi speed for Ethernet to prevent using the slower fallback.
result.put( result.put(
C.NETWORK_TYPE_ETHERNET, C.NETWORK_TYPE_ETHERNET,
DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI.get(groupIndices.get(COUNTRY_GROUP_INDEX_WIFI))); DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI.get(groupIndices[COUNTRY_GROUP_INDEX_WIFI]));
return result; return result;
} }
private static ImmutableList<Integer> getCountryGroupIndices(String countryCode) {
ImmutableList<Integer> groupIndices = DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS.get(countryCode);
// Assume median group if not found.
return groupIndices.isEmpty() ? ImmutableList.of(2, 2, 2, 2, 2, 2) : groupIndices;
}
} }
/** /**
@ -466,250 +468,411 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
return isNetwork && !dataSpec.isFlagSet(DataSpec.FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED); return isNetwork && !dataSpec.isFlagSet(DataSpec.FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED);
} }
private static ImmutableListMultimap<String, Integer> /**
createInitialBitrateCountryGroupAssignment() { * Returns initial bitrate group assignments for a {@code country}. The initial bitrate is a list
return ImmutableListMultimap.<String, Integer>builder() * of indexes for [Wifi, 2G, 3G, 4G, 5G_NSA, 5G_SA].
.putAll("AD", 1, 2, 0, 0, 2, 2) */
.putAll("AE", 1, 4, 4, 4, 3, 2) private static int[] getInitialBitrateCountryGroupAssignment(String country) {
.putAll("AF", 4, 4, 4, 4, 2, 2) switch (country) {
.putAll("AG", 2, 3, 1, 2, 2, 2) case "AE":
.putAll("AI", 1, 2, 2, 2, 2, 2) return new int[] {1, 4, 4, 4, 3, 2};
.putAll("AL", 1, 2, 0, 1, 2, 2) case "AG":
.putAll("AM", 2, 3, 2, 4, 2, 2) return new int[] {2, 3, 1, 2, 2, 2};
.putAll("AO", 3, 4, 3, 2, 2, 2) case "AM":
.putAll("AQ", 4, 2, 2, 2, 2, 2) return new int[] {2, 3, 2, 4, 2, 2};
.putAll("AR", 2, 4, 1, 1, 2, 2) case "AR":
.putAll("AS", 2, 2, 2, 3, 2, 2) return new int[] {2, 4, 1, 1, 2, 2};
.putAll("AT", 0, 0, 0, 0, 0, 2) case "AS":
.putAll("AU", 0, 1, 0, 1, 2, 2) return new int[] {2, 2, 2, 3, 2, 2};
.putAll("AW", 1, 2, 4, 4, 2, 2) case "AU":
.putAll("AX", 0, 2, 2, 2, 2, 2) return new int[] {0, 1, 0, 1, 2, 2};
.putAll("AZ", 3, 2, 4, 4, 2, 2) case "BE":
.putAll("BA", 1, 2, 0, 1, 2, 2) return new int[] {0, 0, 3, 3, 2, 2};
.putAll("BB", 0, 2, 0, 0, 2, 2) case "BF":
.putAll("BD", 2, 1, 3, 3, 2, 2) return new int[] {4, 3, 4, 3, 2, 2};
.putAll("BE", 0, 0, 3, 3, 2, 2) case "BH":
.putAll("BF", 4, 3, 4, 3, 2, 2) return new int[] {1, 2, 2, 4, 4, 2};
.putAll("BG", 0, 0, 0, 0, 1, 2) case "BJ":
.putAll("BH", 1, 2, 2, 4, 4, 2) return new int[] {4, 4, 3, 4, 2, 2};
.putAll("BI", 4, 3, 4, 4, 2, 2) case "BN":
.putAll("BJ", 4, 4, 3, 4, 2, 2) return new int[] {3, 2, 1, 1, 2, 2};
.putAll("BL", 1, 2, 2, 2, 2, 2) case "BO":
.putAll("BM", 1, 2, 0, 0, 2, 2) return new int[] {1, 3, 3, 2, 2, 2};
.putAll("BN", 3, 2, 1, 1, 2, 2) case "BQ":
.putAll("BO", 1, 3, 3, 2, 2, 2) return new int[] {1, 2, 2, 0, 2, 2};
.putAll("BQ", 1, 2, 2, 0, 2, 2) case "BS":
.putAll("BR", 2, 3, 2, 2, 2, 2) return new int[] {4, 2, 2, 3, 2, 2};
.putAll("BS", 4, 2, 2, 3, 2, 2) case "BT":
.putAll("BT", 3, 1, 3, 2, 2, 2) return new int[] {3, 1, 3, 2, 2, 2};
.putAll("BW", 3, 4, 1, 0, 2, 2) case "BY":
.putAll("BY", 0, 1, 1, 3, 2, 2) return new int[] {0, 1, 1, 3, 2, 2};
.putAll("BZ", 2, 4, 2, 2, 2, 2) case "BZ":
.putAll("CA", 0, 2, 1, 2, 4, 1) return new int[] {2, 4, 2, 2, 2, 2};
.putAll("CD", 4, 2, 3, 1, 2, 2) case "CA":
.putAll("CF", 4, 2, 3, 2, 2, 2) return new int[] {0, 2, 1, 2, 4, 1};
.putAll("CG", 2, 4, 3, 4, 2, 2) case "CD":
.putAll("CH", 0, 0, 0, 0, 0, 2) return new int[] {4, 2, 3, 1, 2, 2};
.putAll("CI", 3, 3, 3, 4, 2, 2) case "CF":
.putAll("CK", 2, 2, 2, 1, 2, 2) return new int[] {4, 2, 3, 2, 2, 2};
.putAll("CL", 1, 1, 2, 2, 3, 2) case "CI":
.putAll("CM", 3, 4, 3, 2, 2, 2) return new int[] {3, 3, 3, 4, 2, 2};
.putAll("CN", 2, 0, 2, 2, 3, 1) case "CK":
.putAll("CO", 2, 2, 4, 2, 2, 2) return new int[] {2, 2, 2, 1, 2, 2};
.putAll("CR", 2, 2, 4, 4, 2, 2) case "AO":
.putAll("CU", 4, 4, 3, 2, 2, 2) case "CM":
.putAll("CV", 2, 3, 1, 0, 2, 2) return new int[] {3, 4, 3, 2, 2, 2};
.putAll("CW", 2, 2, 0, 0, 2, 2) case "CN":
.putAll("CX", 1, 2, 2, 2, 2, 2) return new int[] {2, 0, 2, 2, 3, 1};
.putAll("CY", 1, 0, 0, 0, 1, 2) case "CO":
.putAll("CZ", 0, 0, 0, 0, 1, 2) return new int[] {2, 2, 4, 2, 2, 2};
.putAll("DE", 0, 0, 2, 2, 1, 2) case "CR":
.putAll("DJ", 4, 1, 4, 4, 2, 2) return new int[] {2, 2, 4, 4, 2, 2};
.putAll("DK", 0, 0, 1, 0, 0, 2) case "CV":
.putAll("DM", 1, 2, 2, 2, 2, 2) return new int[] {2, 3, 1, 0, 2, 2};
.putAll("DO", 3, 4, 4, 4, 2, 2) case "CW":
.putAll("DZ", 4, 3, 4, 4, 2, 2) return new int[] {2, 2, 0, 0, 2, 2};
.putAll("EC", 2, 4, 2, 1, 2, 2) case "CY":
.putAll("EE", 0, 0, 0, 0, 2, 2) return new int[] {1, 0, 0, 0, 1, 2};
.putAll("EG", 3, 4, 2, 3, 2, 2) case "DE":
.putAll("EH", 2, 2, 2, 2, 2, 2) return new int[] {0, 0, 2, 2, 1, 2};
.putAll("ER", 4, 2, 2, 2, 2, 2) case "DJ":
.putAll("ES", 0, 1, 1, 1, 2, 2) return new int[] {4, 1, 4, 4, 2, 2};
.putAll("ET", 4, 4, 3, 1, 2, 2) case "DK":
.putAll("FI", 0, 0, 0, 1, 0, 2) return new int[] {0, 0, 1, 0, 0, 2};
.putAll("FJ", 3, 1, 3, 3, 2, 2) case "EC":
.putAll("FK", 3, 2, 2, 2, 2, 2) return new int[] {2, 4, 2, 1, 2, 2};
.putAll("FM", 3, 2, 4, 2, 2, 2) case "EG":
.putAll("FO", 0, 2, 0, 0, 2, 2) return new int[] {3, 4, 2, 3, 2, 2};
.putAll("FR", 1, 1, 2, 1, 1, 1) case "ET":
.putAll("GA", 2, 3, 1, 1, 2, 2) return new int[] {4, 4, 3, 1, 2, 2};
.putAll("GB", 0, 0, 1, 1, 2, 3) case "FI":
.putAll("GD", 1, 2, 2, 2, 2, 2) return new int[] {0, 0, 0, 1, 0, 2};
.putAll("GE", 1, 1, 1, 3, 2, 2) case "FJ":
.putAll("GF", 2, 1, 2, 3, 2, 2) return new int[] {3, 1, 3, 3, 2, 2};
.putAll("GG", 0, 2, 0, 0, 2, 2) case "FM":
.putAll("GH", 3, 2, 3, 2, 2, 2) return new int[] {3, 2, 4, 2, 2, 2};
.putAll("GI", 0, 2, 2, 2, 2, 2) case "FR":
.putAll("GL", 1, 2, 0, 0, 2, 2) return new int[] {1, 1, 2, 1, 1, 1};
.putAll("GM", 4, 2, 2, 4, 2, 2) case "GA":
.putAll("GN", 4, 3, 4, 2, 2, 2) return new int[] {2, 3, 1, 1, 2, 2};
.putAll("GP", 2, 1, 2, 3, 2, 2) case "GB":
.putAll("GQ", 4, 2, 3, 4, 2, 2) return new int[] {0, 0, 1, 1, 2, 3};
.putAll("GR", 1, 0, 0, 0, 2, 2) case "GE":
.putAll("GT", 2, 3, 2, 1, 2, 2) return new int[] {1, 1, 1, 3, 2, 2};
.putAll("GU", 1, 2, 4, 4, 2, 2) case "BB":
.putAll("GW", 3, 4, 3, 3, 2, 2) case "FO":
.putAll("GY", 3, 4, 1, 0, 2, 2) case "GG":
.putAll("HK", 0, 1, 2, 3, 2, 0) return new int[] {0, 2, 0, 0, 2, 2};
.putAll("HN", 3, 2, 3, 3, 2, 2) case "GH":
.putAll("HR", 1, 0, 0, 0, 2, 2) return new int[] {3, 2, 3, 2, 2, 2};
.putAll("HT", 4, 4, 4, 4, 2, 2) case "GN":
.putAll("HU", 0, 0, 0, 1, 3, 2) return new int[] {4, 3, 4, 2, 2, 2};
.putAll("ID", 3, 2, 3, 3, 3, 2) case "GQ":
.putAll("IE", 0, 1, 1, 1, 2, 2) return new int[] {4, 2, 3, 4, 2, 2};
.putAll("IL", 1, 1, 2, 3, 4, 2) case "GT":
.putAll("IM", 0, 2, 0, 1, 2, 2) return new int[] {2, 3, 2, 1, 2, 2};
.putAll("IN", 1, 1, 3, 2, 4, 3) case "AW":
.putAll("IO", 4, 2, 2, 2, 2, 2) case "GU":
.putAll("IQ", 3, 3, 3, 3, 2, 2) return new int[] {1, 2, 4, 4, 2, 2};
.putAll("IR", 3, 0, 1, 1, 3, 0) case "BW":
.putAll("IS", 0, 0, 0, 0, 0, 2) case "GY":
.putAll("IT", 0, 1, 0, 1, 1, 2) return new int[] {3, 4, 1, 0, 2, 2};
.putAll("JE", 3, 2, 1, 2, 2, 2) case "HK":
.putAll("JM", 3, 4, 4, 4, 2, 2) return new int[] {0, 1, 2, 3, 2, 0};
.putAll("JO", 1, 0, 0, 1, 2, 2) case "HU":
.putAll("JP", 0, 1, 0, 1, 1, 1) return new int[] {0, 0, 0, 1, 3, 2};
.putAll("KE", 3, 3, 2, 2, 2, 2) case "ID":
.putAll("KG", 2, 1, 1, 1, 2, 2) return new int[] {3, 2, 3, 3, 3, 2};
.putAll("KH", 1, 1, 4, 2, 2, 2) case "ES":
.putAll("KI", 4, 2, 4, 3, 2, 2) case "IE":
.putAll("KM", 4, 2, 4, 3, 2, 2) return new int[] {0, 1, 1, 1, 2, 2};
.putAll("KN", 2, 2, 2, 2, 2, 2) case "IL":
.putAll("KP", 3, 2, 2, 2, 2, 2) return new int[] {1, 1, 2, 3, 4, 2};
.putAll("KR", 0, 0, 1, 3, 4, 4) case "IM":
.putAll("KW", 1, 1, 0, 0, 0, 2) return new int[] {0, 2, 0, 1, 2, 2};
.putAll("KY", 1, 2, 0, 1, 2, 2) case "IN":
.putAll("KZ", 1, 1, 2, 2, 2, 2) return new int[] {1, 1, 3, 2, 4, 3};
.putAll("LA", 2, 2, 1, 2, 2, 2) case "IR":
.putAll("LB", 3, 2, 1, 4, 2, 2) return new int[] {3, 0, 1, 1, 3, 0};
.putAll("LC", 1, 2, 0, 0, 2, 2) case "IT":
.putAll("LI", 0, 2, 2, 2, 2, 2) return new int[] {0, 1, 0, 1, 1, 2};
.putAll("LK", 3, 1, 3, 4, 4, 2) case "JE":
.putAll("LR", 3, 4, 4, 3, 2, 2) return new int[] {3, 2, 1, 2, 2, 2};
.putAll("LS", 3, 3, 4, 3, 2, 2) case "DO":
.putAll("LT", 0, 0, 0, 0, 2, 2) case "JM":
.putAll("LU", 1, 0, 2, 2, 2, 2) return new int[] {3, 4, 4, 4, 2, 2};
.putAll("LV", 0, 0, 0, 0, 2, 2) case "JP":
.putAll("LY", 4, 2, 4, 3, 2, 2) return new int[] {0, 1, 0, 1, 1, 1};
.putAll("MA", 3, 2, 2, 2, 2, 2) case "KE":
.putAll("MC", 0, 2, 2, 0, 2, 2) return new int[] {3, 3, 2, 2, 2, 2};
.putAll("MD", 1, 0, 0, 0, 2, 2) case "KG":
.putAll("ME", 1, 0, 0, 1, 2, 2) return new int[] {2, 1, 1, 1, 2, 2};
.putAll("MF", 1, 2, 1, 0, 2, 2) case "KH":
.putAll("MG", 3, 4, 2, 2, 2, 2) return new int[] {1, 1, 4, 2, 2, 2};
.putAll("MH", 3, 2, 2, 4, 2, 2) case "KR":
.putAll("MK", 1, 0, 0, 0, 2, 2) return new int[] {0, 0, 1, 3, 4, 4};
.putAll("ML", 4, 3, 3, 1, 2, 2) case "KW":
.putAll("MM", 2, 4, 3, 3, 2, 2) return new int[] {1, 1, 0, 0, 0, 2};
.putAll("MN", 2, 0, 1, 2, 2, 2) case "AL":
.putAll("MO", 0, 2, 4, 4, 2, 2) case "BA":
.putAll("MP", 0, 2, 2, 2, 2, 2) case "KY":
.putAll("MQ", 2, 1, 2, 3, 2, 2) return new int[] {1, 2, 0, 1, 2, 2};
.putAll("MR", 4, 1, 3, 4, 2, 2) case "KZ":
.putAll("MS", 1, 2, 2, 2, 2, 2) return new int[] {1, 1, 2, 2, 2, 2};
.putAll("MT", 0, 0, 0, 0, 2, 2) case "LB":
.putAll("MU", 3, 1, 1, 2, 2, 2) return new int[] {3, 2, 1, 4, 2, 2};
.putAll("MV", 3, 4, 1, 4, 2, 2) case "AD":
.putAll("MW", 4, 2, 1, 0, 2, 2) case "BM":
.putAll("MX", 2, 4, 3, 4, 2, 2) case "GL":
.putAll("MY", 2, 1, 3, 3, 2, 2) case "LC":
.putAll("MZ", 3, 2, 2, 2, 2, 2) return new int[] {1, 2, 0, 0, 2, 2};
.putAll("NA", 4, 3, 2, 2, 2, 2) case "LK":
.putAll("NC", 3, 2, 4, 4, 2, 2) return new int[] {3, 1, 3, 4, 4, 2};
.putAll("NE", 4, 4, 4, 4, 2, 2) case "LR":
.putAll("NF", 2, 2, 2, 2, 2, 2) return new int[] {3, 4, 4, 3, 2, 2};
.putAll("NG", 3, 4, 1, 1, 2, 2) case "LS":
.putAll("NI", 2, 3, 4, 3, 2, 2) return new int[] {3, 3, 4, 3, 2, 2};
.putAll("NL", 0, 0, 3, 2, 0, 4) case "LU":
.putAll("NO", 0, 0, 2, 0, 0, 2) return new int[] {1, 0, 2, 2, 2, 2};
.putAll("NP", 2, 1, 4, 3, 2, 2) case "MC":
.putAll("NR", 3, 2, 2, 0, 2, 2) return new int[] {0, 2, 2, 0, 2, 2};
.putAll("NU", 4, 2, 2, 2, 2, 2) case "JO":
.putAll("NZ", 1, 0, 1, 2, 4, 2) case "ME":
.putAll("OM", 2, 3, 1, 3, 4, 2) return new int[] {1, 0, 0, 1, 2, 2};
.putAll("PA", 1, 3, 3, 3, 2, 2) case "MF":
.putAll("PE", 2, 3, 4, 4, 4, 2) return new int[] {1, 2, 1, 0, 2, 2};
.putAll("PF", 2, 3, 3, 1, 2, 2) case "MG":
.putAll("PG", 4, 4, 3, 2, 2, 2) return new int[] {3, 4, 2, 2, 2, 2};
.putAll("PH", 2, 2, 3, 3, 3, 2) case "MH":
.putAll("PK", 3, 2, 3, 3, 2, 2) return new int[] {3, 2, 2, 4, 2, 2};
.putAll("PL", 1, 1, 2, 2, 3, 2) case "ML":
.putAll("PM", 0, 2, 2, 2, 2, 2) return new int[] {4, 3, 3, 1, 2, 2};
.putAll("PR", 2, 3, 2, 2, 3, 3) case "MM":
.putAll("PS", 3, 4, 1, 2, 2, 2) return new int[] {2, 4, 3, 3, 2, 2};
.putAll("PT", 0, 1, 0, 0, 2, 2) case "MN":
.putAll("PW", 2, 2, 4, 1, 2, 2) return new int[] {2, 0, 1, 2, 2, 2};
.putAll("PY", 2, 2, 3, 2, 2, 2) case "MO":
.putAll("QA", 2, 4, 2, 4, 4, 2) return new int[] {0, 2, 4, 4, 2, 2};
.putAll("RE", 1, 1, 1, 2, 2, 2) case "GF":
.putAll("RO", 0, 0, 1, 1, 1, 2) case "GP":
.putAll("RS", 1, 0, 0, 0, 2, 2) case "MQ":
.putAll("RU", 0, 0, 0, 1, 2, 2) return new int[] {2, 1, 2, 3, 2, 2};
.putAll("RW", 3, 4, 3, 0, 2, 2) case "MR":
.putAll("SA", 2, 2, 1, 1, 2, 2) return new int[] {4, 1, 3, 4, 2, 2};
.putAll("SB", 4, 2, 4, 3, 2, 2) case "EE":
.putAll("SC", 4, 3, 0, 2, 2, 2) case "LT":
.putAll("SD", 4, 4, 4, 4, 2, 2) case "LV":
.putAll("SE", 0, 0, 0, 0, 0, 2) case "MT":
.putAll("SG", 1, 1, 2, 3, 1, 4) return new int[] {0, 0, 0, 0, 2, 2};
.putAll("SH", 4, 2, 2, 2, 2, 2) case "MU":
.putAll("SI", 0, 0, 0, 0, 1, 2) return new int[] {3, 1, 1, 2, 2, 2};
.putAll("SJ", 0, 2, 2, 2, 2, 2) case "MV":
.putAll("SK", 0, 0, 0, 0, 0, 2) return new int[] {3, 4, 1, 4, 2, 2};
.putAll("SL", 4, 3, 4, 1, 2, 2) case "MW":
.putAll("SM", 0, 2, 2, 2, 2, 2) return new int[] {4, 2, 1, 0, 2, 2};
.putAll("SN", 4, 4, 4, 4, 2, 2) case "CG":
.putAll("SO", 3, 2, 3, 3, 2, 2) case "MX":
.putAll("SR", 2, 3, 2, 2, 2, 2) return new int[] {2, 4, 3, 4, 2, 2};
.putAll("SS", 4, 2, 2, 2, 2, 2) case "BD":
.putAll("ST", 3, 2, 2, 2, 2, 2) case "MY":
.putAll("SV", 2, 2, 3, 3, 2, 2) return new int[] {2, 1, 3, 3, 2, 2};
.putAll("SX", 2, 2, 1, 0, 2, 2) case "NA":
.putAll("SY", 4, 3, 4, 4, 2, 2) return new int[] {4, 3, 2, 2, 2, 2};
.putAll("SZ", 4, 3, 2, 4, 2, 2) case "AZ":
.putAll("TC", 2, 2, 1, 0, 2, 2) case "NC":
.putAll("TD", 4, 4, 4, 4, 2, 2) return new int[] {3, 2, 4, 4, 2, 2};
.putAll("TG", 3, 3, 2, 0, 2, 2) case "NG":
.putAll("TH", 0, 3, 2, 3, 3, 0) return new int[] {3, 4, 1, 1, 2, 2};
.putAll("TJ", 4, 2, 4, 4, 2, 2) case "NI":
.putAll("TL", 4, 3, 4, 4, 2, 2) return new int[] {2, 3, 4, 3, 2, 2};
.putAll("TM", 4, 2, 4, 2, 2, 2) case "NL":
.putAll("TN", 2, 2, 1, 1, 2, 2) return new int[] {0, 0, 3, 2, 0, 4};
.putAll("TO", 4, 2, 3, 3, 2, 2) case "NO":
.putAll("TR", 1, 1, 0, 1, 2, 2) return new int[] {0, 0, 2, 0, 0, 2};
.putAll("TT", 1, 4, 1, 1, 2, 2) case "NP":
.putAll("TV", 4, 2, 2, 2, 2, 2) return new int[] {2, 1, 4, 3, 2, 2};
.putAll("TW", 0, 0, 0, 0, 0, 0) case "NR":
.putAll("TZ", 3, 4, 3, 3, 2, 2) return new int[] {3, 2, 2, 0, 2, 2};
.putAll("UA", 0, 3, 1, 1, 2, 2) case "NZ":
.putAll("UG", 3, 3, 3, 3, 2, 2) return new int[] {1, 0, 1, 2, 4, 2};
.putAll("US", 1, 1, 2, 2, 3, 2) case "OM":
.putAll("UY", 2, 2, 1, 2, 2, 2) return new int[] {2, 3, 1, 3, 4, 2};
.putAll("UZ", 2, 2, 3, 4, 2, 2) case "PA":
.putAll("VC", 1, 2, 2, 2, 2, 2) return new int[] {1, 3, 3, 3, 2, 2};
.putAll("VE", 4, 4, 4, 4, 2, 2) case "PE":
.putAll("VG", 2, 2, 1, 1, 2, 2) return new int[] {2, 3, 4, 4, 4, 2};
.putAll("VI", 1, 2, 1, 3, 2, 2) case "PF":
.putAll("VN", 0, 3, 3, 4, 2, 2) return new int[] {2, 3, 3, 1, 2, 2};
.putAll("VU", 4, 2, 2, 1, 2, 2) case "CU":
.putAll("WF", 4, 2, 2, 4, 2, 2) case "PG":
.putAll("WS", 3, 1, 2, 1, 2, 2) return new int[] {4, 4, 3, 2, 2, 2};
.putAll("XK", 1, 1, 1, 1, 2, 2) case "PH":
.putAll("YE", 4, 4, 4, 4, 2, 2) return new int[] {2, 2, 3, 3, 3, 2};
.putAll("YT", 4, 1, 1, 1, 2, 2) case "PR":
.putAll("ZA", 3, 3, 1, 1, 1, 2) return new int[] {2, 3, 2, 2, 3, 3};
.putAll("ZM", 3, 3, 4, 2, 2, 2) case "PS":
.putAll("ZW", 3, 2, 4, 3, 2, 2) return new int[] {3, 4, 1, 2, 2, 2};
.build(); case "PT":
return new int[] {0, 1, 0, 0, 2, 2};
case "PW":
return new int[] {2, 2, 4, 1, 2, 2};
case "PY":
return new int[] {2, 2, 3, 2, 2, 2};
case "QA":
return new int[] {2, 4, 2, 4, 4, 2};
case "RE":
return new int[] {1, 1, 1, 2, 2, 2};
case "RO":
return new int[] {0, 0, 1, 1, 1, 2};
case "GR":
case "HR":
case "MD":
case "MK":
case "RS":
return new int[] {1, 0, 0, 0, 2, 2};
case "RU":
return new int[] {0, 0, 0, 1, 2, 2};
case "RW":
return new int[] {3, 4, 3, 0, 2, 2};
case "KI":
case "KM":
case "LY":
case "SB":
return new int[] {4, 2, 4, 3, 2, 2};
case "SC":
return new int[] {4, 3, 0, 2, 2, 2};
case "SG":
return new int[] {1, 1, 2, 3, 1, 4};
case "BG":
case "CZ":
case "SI":
return new int[] {0, 0, 0, 0, 1, 2};
case "AT":
case "CH":
case "IS":
case "SE":
case "SK":
return new int[] {0, 0, 0, 0, 0, 2};
case "SL":
return new int[] {4, 3, 4, 1, 2, 2};
case "AX":
case "GI":
case "LI":
case "MP":
case "PM":
case "SJ":
case "SM":
return new int[] {0, 2, 2, 2, 2, 2};
case "HN":
case "PK":
case "SO":
return new int[] {3, 2, 3, 3, 2, 2};
case "BR":
case "SR":
return new int[] {2, 3, 2, 2, 2, 2};
case "FK":
case "KP":
case "MA":
case "MZ":
case "ST":
return new int[] {3, 2, 2, 2, 2, 2};
case "SV":
return new int[] {2, 2, 3, 3, 2, 2};
case "SZ":
return new int[] {4, 3, 2, 4, 2, 2};
case "SX":
case "TC":
return new int[] {2, 2, 1, 0, 2, 2};
case "TG":
return new int[] {3, 3, 2, 0, 2, 2};
case "TH":
return new int[] {0, 3, 2, 3, 3, 0};
case "TJ":
return new int[] {4, 2, 4, 4, 2, 2};
case "BI":
case "DZ":
case "SY":
case "TL":
return new int[] {4, 3, 4, 4, 2, 2};
case "TM":
return new int[] {4, 2, 4, 2, 2, 2};
case "TO":
return new int[] {4, 2, 3, 3, 2, 2};
case "TR":
return new int[] {1, 1, 0, 1, 2, 2};
case "TT":
return new int[] {1, 4, 1, 1, 2, 2};
case "AQ":
case "ER":
case "IO":
case "NU":
case "SH":
case "SS":
case "TV":
return new int[] {4, 2, 2, 2, 2, 2};
case "TW":
return new int[] {0, 0, 0, 0, 0, 0};
case "GW":
case "TZ":
return new int[] {3, 4, 3, 3, 2, 2};
case "UA":
return new int[] {0, 3, 1, 1, 2, 2};
case "IQ":
case "UG":
return new int[] {3, 3, 3, 3, 2, 2};
case "CL":
case "PL":
case "US":
return new int[] {1, 1, 2, 2, 3, 2};
case "LA":
case "UY":
return new int[] {2, 2, 1, 2, 2, 2};
case "UZ":
return new int[] {2, 2, 3, 4, 2, 2};
case "AI":
case "BL":
case "CX":
case "DM":
case "GD":
case "MS":
case "VC":
return new int[] {1, 2, 2, 2, 2, 2};
case "SA":
case "TN":
case "VG":
return new int[] {2, 2, 1, 1, 2, 2};
case "VI":
return new int[] {1, 2, 1, 3, 2, 2};
case "VN":
return new int[] {0, 3, 3, 4, 2, 2};
case "VU":
return new int[] {4, 2, 2, 1, 2, 2};
case "GM":
case "WF":
return new int[] {4, 2, 2, 4, 2, 2};
case "WS":
return new int[] {3, 1, 2, 1, 2, 2};
case "XK":
return new int[] {1, 1, 1, 1, 2, 2};
case "AF":
case "HT":
case "NE":
case "SD":
case "SN":
case "TD":
case "VE":
case "YE":
return new int[] {4, 4, 4, 4, 2, 2};
case "YT":
return new int[] {4, 1, 1, 1, 2, 2};
case "ZA":
return new int[] {3, 3, 1, 1, 1, 2};
case "ZM":
return new int[] {3, 3, 4, 2, 2, 2};
case "ZW":
return new int[] {3, 2, 4, 3, 2, 2};
default:
return new int[] {2, 2, 2, 2, 2, 2};
}
} }
} }