1/*
2 * Copyright (C) 2014 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
17package com.android.server.hdmi;
18
19import android.util.SparseIntArray;
20
21/**
22 * Unmodifiable version of {@link SparseIntArray}.
23 */
24final class UnmodifiableSparseIntArray {
25    private static final String TAG = "ImmutableSparseIntArray";
26
27    private final SparseIntArray mArray;
28
29    public UnmodifiableSparseIntArray(SparseIntArray array) {
30        mArray = array;
31    }
32
33    public int size() {
34        return mArray.size();
35    }
36
37    public int get(int key) {
38        return mArray.get(key);
39    }
40
41    public int get(int key, int valueIfKeyNotFound) {
42        return mArray.get(key, valueIfKeyNotFound);
43    }
44
45    public int keyAt(int index) {
46        return mArray.keyAt(index);
47    }
48
49    public int valueAt(int index) {
50        return mArray.valueAt(index);
51    }
52
53    public int indexOfValue(int value) {
54        return mArray.indexOfValue(value);
55    }
56
57    @Override
58    public String toString() {
59        return mArray.toString();
60    }
61}
62