test_class.declarator: prefs
test_class.modifier: private
test_class.original_string: private SharedPreferences prefs;
test_class.type: SharedPreferences
test_class.var_name: prefs
test_class.declarator: RENAMERS = {
          PrefMigrator.renameKey("colour").toKey("couleur"),
          PrefMigrator.renameKey("vegetable").toKey("legume")
      }
test_class.modifier: private static final
test_class.original_string: private static final Migration[] RENAMERS = {
          PrefMigrator.renameKey("colour").toKey("couleur"),
          PrefMigrator.renameKey("vegetable").toKey("legume")
      };
test_class.type: Migration[]
test_class.var_name: RENAMERS
test_class.declarator: TRANSLATORS = {
          PrefMigrator.translateKey("colour").toKey("couleur")
              .fromValue("red").toValue("rouge")
              .fromValue("green").toValue("vert"),
          PrefMigrator.translateKey("vegetable").toKey("legume")
              .fromValue("tomato").toValue("tomate")
              .fromValue("eggplant").toValue("aubergine")
      }
test_class.modifier: private static final
test_class.original_string: private static final Migration[] TRANSLATORS = {
          PrefMigrator.translateKey("colour").toKey("couleur")
              .fromValue("red").toValue("rouge")
              .fromValue("green").toValue("vert"),
          PrefMigrator.translateKey("vegetable").toKey("legume")
              .fromValue("tomato").toValue("tomate")
              .fromValue("eggplant").toValue("aubergine")
      };
test_class.type: Migration[]
test_class.var_name: TRANSLATORS
test_class.declarator: KEY_SPLITTER = {
          PrefMigrator.translateKey("fruit").toKey("pear")
              .fromValue("pear_anjou").toValue("anjou")
              .fromValue("pear_bartlett").toValue("bartlett"),
          PrefMigrator.translateKey("fruit").toKey("melon")
              .fromValue("melon_cantaloupe").toValue("cantaloupe")
              .fromValue("melon_watermelon").toValue("watermelon")
      }
test_class.modifier: private static final
test_class.original_string: private static final Migration[] KEY_SPLITTER = {
          PrefMigrator.translateKey("fruit").toKey("pear")
              .fromValue("pear_anjou").toValue("anjou")
              .fromValue("pear_bartlett").toValue("bartlett"),
          PrefMigrator.translateKey("fruit").toKey("melon")
              .fromValue("melon_cantaloupe").toValue("cantaloupe")
              .fromValue("melon_watermelon").toValue("watermelon")
      };
test_class.type: Migration[]
test_class.var_name: KEY_SPLITTER
test_class.declarator: KEY_MERGER = {
          PrefMigrator.translateKey("pear").toKey("fruit")
              .fromValue("anjou").toValue("pear_anjou")
              .fromValue("bartlett").toValue("pear_bartlett"),
          PrefMigrator.translateKey("melon").toKey("fruit")
              .fromValue("cantaloupe").toValue("melon_cantaloupe")
              .fromValue("watermelon").toValue("melon_watermelon")
      }
test_class.modifier: private static final
test_class.original_string: private static final Migration[] KEY_MERGER = {
          PrefMigrator.translateKey("pear").toKey("fruit")
              .fromValue("anjou").toValue("pear_anjou")
              .fromValue("bartlett").toValue("pear_bartlett"),
          PrefMigrator.translateKey("melon").toKey("fruit")
              .fromValue("cantaloupe").toValue("melon_cantaloupe")
              .fromValue("watermelon").toValue("melon_watermelon")
      };
test_class.type: Migration[]
test_class.var_name: KEY_MERGER
test_class.declarator: COMBINER = {
          PrefMigrator.combineKeys("red", "blue")
              .withValues(true, true).toPairs("mix", "purple")
              .withValues(true, false).toPairs("mix", "red")
              .withValues(true, null).toPairs("mix", "red")
              .withValues(false, true).toPairs("mix", "blue")
              .withValues(null, true).toPairs("mix", "blue")
      }
test_class.modifier: private static final
test_class.original_string: private static final Migration[] COMBINER = {
          PrefMigrator.combineKeys("red", "blue")
              .withValues(true, true).toPairs("mix", "purple")
              .withValues(true, false).toPairs("mix", "red")
              .withValues(true, null).toPairs("mix", "red")
              .withValues(false, true).toPairs("mix", "blue")
              .withValues(null, true).toPairs("mix", "blue")
      };
test_class.type: Migration[]
test_class.var_name: COMBINER
test_class.declarator: COMBINER_MODIFIER = {
          PrefMigrator.combineKeys("vehicle", "fast")
              .withValues("bicycle", true).toPairs("vehicle", "fast_bicycle")
              .withValues("car", true).toPairs("vehicle", "fast_car")
      }
test_class.modifier: private static final
test_class.original_string: private static final Migration[] COMBINER_MODIFIER = {
          PrefMigrator.combineKeys("vehicle", "fast")
              .withValues("bicycle", true).toPairs("vehicle", "fast_bicycle")
              .withValues("car", true).toPairs("vehicle", "fast_car")
      };
test_class.type: Migration[]
test_class.var_name: COMBINER_MODIFIER
test_class.file: collect_app/src/test/java/org/odk/collect/android/preferences/PrefMigratorTest.java
test_class.identifier: PrefMigratorTest
test_case.body: @Test public void shouldMigrateGoogleMapSettings() {
          initPrefs("map_sdk_behavior", "google_maps", "map_basemap_behavior", "streets");
          PrefMigrator.migrateSharedPrefs();
          assertPrefs("basemap_source", "google", "google_map_style", String.valueOf(GoogleMap.MAP_TYPE_NORMAL));
  
          initPrefs("map_sdk_behavior", "google_maps", "map_basemap_behavior", "satellite");
          PrefMigrator.migrateSharedPrefs();
          assertPrefs("basemap_source", "google", "google_map_style", String.valueOf(GoogleMap.MAP_TYPE_SATELLITE));
  
          initPrefs("map_sdk_behavior", "google_maps", "map_basemap_behavior", "terrain\u200e");
          PrefMigrator.migrateSharedPrefs();
          assertPrefs("basemap_source", "google", "google_map_style", String.valueOf(GoogleMap.MAP_TYPE_TERRAIN));
  
          initPrefs("map_sdk_behavior", "google_maps", "map_basemap_behavior", "hybrid");
          PrefMigrator.migrateSharedPrefs();
          assertPrefs("basemap_source", "google", "google_map_style", String.valueOf(GoogleMap.MAP_TYPE_HYBRID));
      }
test_case.class_method_signature: PrefMigratorTest.shouldMigrateGoogleMapSettings()
test_case.full_signature: @Test public void shouldMigrateGoogleMapSettings()
test_case.identifier: shouldMigrateGoogleMapSettings
test_case.invocations: initPrefs migrateSharedPrefs assertPrefs valueOf initPrefs migrateSharedPrefs assertPrefs valueOf initPrefs migrateSharedPrefs assertPrefs valueOf initPrefs migrateSharedPrefs assertPrefs valueOf
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldMigrateGoogleMapSettings()
focal_class.declarator: MIGRATIONS = {
          translateKey("map_sdk_behavior").toKey(KEY_BASEMAP_SOURCE)
              .fromValue("google_maps").toValue("google")
              .fromValue("mapbox_maps").toValue("mapbox"),
  
          // ListPreferences can only handle string values, so we use string values here.
          // Note that unfortunately there was a hidden U+200E character in the preference
          // value for "terrain" in previous versions of ODK Collect, so we need to
          // include that character to match that value correctly.
          translateKey("map_basemap_behavior").toKey(KEY_GOOGLE_MAP_STYLE)
              .fromValue("streets").toValue(Integer.toString(GoogleMap.MAP_TYPE_NORMAL))
              .fromValue("terrain\u200e").toValue(Integer.toString(GoogleMap.MAP_TYPE_TERRAIN))
              .fromValue("terrain").toValue(Integer.toString(GoogleMap.MAP_TYPE_TERRAIN))
              .fromValue("hybrid").toValue(Integer.toString(GoogleMap.MAP_TYPE_HYBRID))
              .fromValue("satellite").toValue(Integer.toString(GoogleMap.MAP_TYPE_SATELLITE)),
  
          translateKey("map_basemap_behavior").toKey(KEY_MAPBOX_MAP_STYLE)
              .fromValue("mapbox_streets").toValue(Style.MAPBOX_STREETS)
              .fromValue("mapbox_light").toValue(Style.LIGHT)
              .fromValue("mapbox_dark").toValue(Style.DARK)
              .fromValue("mapbox_satellite").toValue(Style.SATELLITE)
              .fromValue("mapbox_satellite_streets").toValue(Style.SATELLITE_STREETS)
              .fromValue("mapbox_outdoors").toValue(Style.OUTDOORS),
  
          // When the map_sdk_behavior is "osmdroid", we have to also examine the
          // map_basemap_behavior key to determine the new basemap source.
          combineKeys("map_sdk_behavior", "map_basemap_behavior")
              .withValues("osmdroid", "openmap_streets")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_OSM)
  
              .withValues("osmdroid", "openmap_usgs_topo")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_USGS, KEY_USGS_MAP_STYLE, "topographic")
              .withValues("osmdroid", "openmap_usgs_sat")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_USGS, KEY_USGS_MAP_STYLE, "hybrid")
              .withValues("osmdroid", "openmap_usgs_img")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_USGS, KEY_USGS_MAP_STYLE, "satellite")
  
              .withValues("osmdroid", "openmap_stamen_terrain")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_STAMEN)
  
              .withValues("osmdroid", "openmap_carto_positron")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_CARTO, KEY_CARTO_MAP_STYLE, "positron")
              .withValues("osmdroid", "openmap_carto_darkmatter")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_CARTO, KEY_CARTO_MAP_STYLE, "dark_matter"),
      }
focal_class.modifier: static final
focal_class.original_string: static final Migration[] MIGRATIONS = {
          translateKey("map_sdk_behavior").toKey(KEY_BASEMAP_SOURCE)
              .fromValue("google_maps").toValue("google")
              .fromValue("mapbox_maps").toValue("mapbox"),
  
          // ListPreferences can only handle string values, so we use string values here.
          // Note that unfortunately there was a hidden U+200E character in the preference
          // value for "terrain" in previous versions of ODK Collect, so we need to
          // include that character to match that value correctly.
          translateKey("map_basemap_behavior").toKey(KEY_GOOGLE_MAP_STYLE)
              .fromValue("streets").toValue(Integer.toString(GoogleMap.MAP_TYPE_NORMAL))
              .fromValue("terrain\u200e").toValue(Integer.toString(GoogleMap.MAP_TYPE_TERRAIN))
              .fromValue("terrain").toValue(Integer.toString(GoogleMap.MAP_TYPE_TERRAIN))
              .fromValue("hybrid").toValue(Integer.toString(GoogleMap.MAP_TYPE_HYBRID))
              .fromValue("satellite").toValue(Integer.toString(GoogleMap.MAP_TYPE_SATELLITE)),
  
          translateKey("map_basemap_behavior").toKey(KEY_MAPBOX_MAP_STYLE)
              .fromValue("mapbox_streets").toValue(Style.MAPBOX_STREETS)
              .fromValue("mapbox_light").toValue(Style.LIGHT)
              .fromValue("mapbox_dark").toValue(Style.DARK)
              .fromValue("mapbox_satellite").toValue(Style.SATELLITE)
              .fromValue("mapbox_satellite_streets").toValue(Style.SATELLITE_STREETS)
              .fromValue("mapbox_outdoors").toValue(Style.OUTDOORS),
  
          // When the map_sdk_behavior is "osmdroid", we have to also examine the
          // map_basemap_behavior key to determine the new basemap source.
          combineKeys("map_sdk_behavior", "map_basemap_behavior")
              .withValues("osmdroid", "openmap_streets")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_OSM)
  
              .withValues("osmdroid", "openmap_usgs_topo")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_USGS, KEY_USGS_MAP_STYLE, "topographic")
              .withValues("osmdroid", "openmap_usgs_sat")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_USGS, KEY_USGS_MAP_STYLE, "hybrid")
              .withValues("osmdroid", "openmap_usgs_img")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_USGS, KEY_USGS_MAP_STYLE, "satellite")
  
              .withValues("osmdroid", "openmap_stamen_terrain")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_STAMEN)
  
              .withValues("osmdroid", "openmap_carto_positron")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_CARTO, KEY_CARTO_MAP_STYLE, "positron")
              .withValues("osmdroid", "openmap_carto_darkmatter")
                  .toPairs(KEY_BASEMAP_SOURCE, BASEMAP_SOURCE_CARTO, KEY_CARTO_MAP_STYLE, "dark_matter"),
      };
focal_class.type: Migration[]
focal_class.var_name: MIGRATIONS
focal_class.declarator: ADMIN_MIGRATIONS = {
          // When either the map SDK or the basemap selection were previously
          // hidden, we want to hide the entire Maps preference screen.
          translateKey("show_map_sdk").toKey("maps")
              .fromValue(false).toValue(false),
          translateKey("show_map_basemap").toKey("maps")
              .fromValue(false).toValue(false)
      }
focal_class.modifier: static final
focal_class.original_string: static final Migration[] ADMIN_MIGRATIONS = {
          // When either the map SDK or the basemap selection were previously
          // hidden, we want to hide the entire Maps preference screen.
          translateKey("show_map_sdk").toKey("maps")
              .fromValue(false).toValue(false),
          translateKey("show_map_basemap").toKey("maps")
              .fromValue(false).toValue(false)
      };
focal_class.type: Migration[]
focal_class.var_name: ADMIN_MIGRATIONS
focal_class.file: collect_app/src/main/java/org/odk/collect/android/preferences/PrefMigrator.java
focal_class.identifier: PrefMigrator
focal_class.class_method_signature: PrefMigrator.PrefMigrator()
focal_class.full_signature: private  PrefMigrator()
focal_class.identifier: PrefMigrator
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  PrefMigrator()
focal_class.class_method_signature: PrefMigrator.migrate(SharedPreferences prefs, Migration... migrations)
focal_class.full_signature: public static void migrate(SharedPreferences prefs, Migration... migrations)
focal_class.identifier: migrate
focal_class.modifiers: public static
focal_class.parameters: (SharedPreferences prefs, Migration... migrations)
focal_class.return: void
focal_class.signature: void migrate(SharedPreferences prefs, Migration... migrations)
focal_class.class_method_signature: PrefMigrator.migrateSharedPrefs()
focal_class.full_signature: public static void migrateSharedPrefs()
focal_class.identifier: migrateSharedPrefs
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void migrateSharedPrefs()
focal_class.class_method_signature: PrefMigrator.renameKey(String oldKey)
focal_class.full_signature: static KeyRenamer renameKey(String oldKey)
focal_class.identifier: renameKey
focal_class.modifiers: static
focal_class.parameters: (String oldKey)
focal_class.return: KeyRenamer
focal_class.signature: KeyRenamer renameKey(String oldKey)
focal_class.class_method_signature: PrefMigrator.translateKey(String oldKey)
focal_class.full_signature: static KeyTranslator translateKey(String oldKey)
focal_class.identifier: translateKey
focal_class.modifiers: static
focal_class.parameters: (String oldKey)
focal_class.return: KeyTranslator
focal_class.signature: KeyTranslator translateKey(String oldKey)
focal_class.class_method_signature: PrefMigrator.combineKeys(String... oldKeys)
focal_class.full_signature: static KeyCombiner combineKeys(String... oldKeys)
focal_class.identifier: combineKeys
focal_class.modifiers: static
focal_class.parameters: (String... oldKeys)
focal_class.return: KeyCombiner
focal_class.signature: KeyCombiner combineKeys(String... oldKeys)
focal_class.class_method_signature: PrefMigrator.replace(SharedPreferences prefs, String oldKey, String newKey, Object newValue)
focal_class.full_signature: @SuppressLint("ApplySharedPref") private static void replace(SharedPreferences prefs, String oldKey, String newKey, Object newValue)
focal_class.identifier: replace
focal_class.modifiers: @SuppressLint("ApplySharedPref") private static
focal_class.parameters: (SharedPreferences prefs, String oldKey, String newKey, Object newValue)
focal_class.return: void
focal_class.signature: void replace(SharedPreferences prefs, String oldKey, String newKey, Object newValue)
focal_class.class_method_signature: PrefMigrator.replace(SharedPreferences prefs, String[] oldKeys, Pair... newPairs)
focal_class.full_signature: @SuppressLint("ApplySharedPref") private static void replace(SharedPreferences prefs, String[] oldKeys, Pair... newPairs)
focal_class.identifier: replace
focal_class.modifiers: @SuppressLint("ApplySharedPref") private static
focal_class.parameters: (SharedPreferences prefs, String[] oldKeys, Pair... newPairs)
focal_class.return: void
focal_class.signature: void replace(SharedPreferences prefs, String[] oldKeys, Pair... newPairs)
focal_class.class_method_signature: PrefMigrator.put(SharedPreferences.Editor editor, String key, Object value)
focal_class.full_signature: private static void put(SharedPreferences.Editor editor, String key, Object value)
focal_class.identifier: put
focal_class.modifiers: private static
focal_class.parameters: (SharedPreferences.Editor editor, String key, Object value)
focal_class.return: void
focal_class.signature: void put(SharedPreferences.Editor editor, String key, Object value)
focal_class.class_method_signature: PrefMigrator.asPairs(Object... args)
focal_class.full_signature: private static Pair[] asPairs(Object... args)
focal_class.identifier: asPairs
focal_class.modifiers: private static
focal_class.parameters: (Object... args)
focal_class.return: Pair[]
focal_class.signature: Pair[] asPairs(Object... args)
focal_method.body: public static void migrateSharedPrefs() {
          migrate(PrefUtils.getSharedPrefs(), MIGRATIONS);
          migrate(PrefUtils.getAdminSharedPrefs(), ADMIN_MIGRATIONS);
      }
focal_method.class_method_signature: PrefMigrator.migrateSharedPrefs()
focal_method.full_signature: public static void migrateSharedPrefs()
focal_method.identifier: migrateSharedPrefs
focal_method.invocations: migrate getSharedPrefs migrate getAdminSharedPrefs
focal_method.modifiers: public static
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void migrateSharedPrefs()