• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.timezone.location.tools;
18 
19 import com.android.timezone.location.storage.tzs2range.TzS2RangeFileFormat;
20 
21 /** Some sample file formats. */
22 final class FileFormats {
23 
24     private static final TzS2RangeFileFormat FILE_FORMAT_12 =
25             new TzS2RangeFileFormat(12, 11, 16, 1, 32, 11);
26 
27     private static final TzS2RangeFileFormat FILE_FORMAT_14 =
28             new TzS2RangeFileFormat(14, 13, 18, 1, 32, 12);
29 
30     private static final TzS2RangeFileFormat FILE_FORMAT_16 =
31             new TzS2RangeFileFormat(16, 13, 22, 1, 40, 12);
32 
33     /** Maps an S2 level to one of the file format constants declared on by class. */
getFileFormatForLevel(int s2Level)34     static TzS2RangeFileFormat getFileFormatForLevel(int s2Level) {
35         switch (s2Level) {
36             case 12:
37                 return FILE_FORMAT_12;
38             case 14:
39                 return FILE_FORMAT_14;
40             case 16:
41                 return FILE_FORMAT_16;
42             default:
43                 throw new IllegalArgumentException("s2Level=" + s2Level + " not mapped");
44         }
45     }
46 }
47