1e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov/*
21bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver * Copyright 2013, Google Inc.
3e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * All rights reserved.
4e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov *
5e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * Redistribution and use in source and binary forms, with or without
6e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * modification, are permitted provided that the following conditions are
7e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * met:
8e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov *
9e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov *     * Redistributions of source code must retain the above copyright
10e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * notice, this list of conditions and the following disclaimer.
11e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov *     * Redistributions in binary form must reproduce the above
12e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * copyright notice, this list of conditions and the following disclaimer
13e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * in the documentation and/or other materials provided with the
14e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * distribution.
15e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov *     * Neither the name of Google Inc. nor the names of its
16e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * contributors may be used to endorse or promote products derived from
17e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * this software without specific prior written permission.
18e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov *
19e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov */
31e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov
321bf6f2324541df184689fdb2c0d8188af5221784Ben Gruverpackage org.jf.dexlib2.writer.pool;
33e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov
341bf6f2324541df184689fdb2c0d8188af5221784Ben Gruverimport org.jf.dexlib2.writer.DexWriter;
351bf6f2324541df184689fdb2c0d8188af5221784Ben Gruverimport org.jf.dexlib2.writer.NullableOffsetSection;
36e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov
371bf6f2324541df184689fdb2c0d8188af5221784Ben Gruverimport javax.annotation.Nullable;
381bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver
391bf6f2324541df184689fdb2c0d8188af5221784Ben Gruverpublic abstract class BaseNullableOffsetPool<Key> extends BaseOffsetPool<Key>
401bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver        implements NullableOffsetSection<Key> {
411bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver    @Override public int getNullableItemOffset(@Nullable Key key) {
421bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver        if (key == null) {
431bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver            return DexWriter.NO_OFFSET;
441bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver        }
451bf6f2324541df184689fdb2c0d8188af5221784Ben Gruver        return getItemOffset(key);
46e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov    }
47e05e01eee08cb78748a657e73f2444884f3a1663Izzat Bahadirov}
48