Format.java revision 0c65e0f4f54ead8fd2832c954d516367b3556ae3
1/*
2 * [The "BSD licence"]
3 * Copyright (c) 2009 Ben Gruver
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 *    derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29package org.jf.dexlib.Code.Format;
30
31import org.jf.dexlib.Code.Instruction;
32
33public enum Format {
34    Format10t(Instruction10t.Factory, 2),
35    Format10x(Instruction10x.Factory, 2),
36    Format11n(Instruction11n.Factory, 2),
37    Format11x(Instruction11x.Factory, 2),
38    Format12x(Instruction12x.Factory, 2),
39    Format20t(Instruction20t.Factory, 4),
40    Format21c(Instruction21c.Factory, 4),
41    Format21h(Instruction21h.Factory, 4),
42    Format21s(Instruction21s.Factory, 4),
43    Format21t(Instruction21t.Factory, 4),
44    Format22b(Instruction22b.Factory, 4),
45    Format22c(Instruction22c.Factory, 4),
46    Format22cs(Instruction22cs.Factory, 4),
47    Format22s(Instruction22s.Factory, 4),
48    Format22t(Instruction22t.Factory, 4),
49    Format22x(Instruction22x.Factory, 4),
50    Format23x(Instruction23x.Factory, 4),
51    Format30t(Instruction30t.Factory, 6),
52    Format31c(Instruction31c.Factory, 6),
53    Format31i(Instruction31i.Factory, 6),
54    Format31t(Instruction31t.Factory, 6),
55    Format32x(Instruction32x.Factory, 6),
56    Format35c(Instruction35c.Factory, 6),
57    Format35s(Instruction35s.Factory, 6),
58    Format35ms(Instruction35ms.Factory, 6),
59    Format3rc(Instruction3rc.Factory, 6),
60    Format3rms(Instruction3rms.Factory, 6),
61    Format51l(Instruction51l.Factory, 10),
62    ArrayData(null, -1, true),
63    PackedSwitchData(null, -1, true),
64    SparseSwitchData(null, -1, true),
65    UnresolvedNullReference(null, -1, false),
66    ;
67
68    public final Instruction.InstructionFactory Factory;
69    public final int size;
70    public final boolean variableSizeFormat;
71
72    private Format(Instruction.InstructionFactory factory, int size) {
73        this(factory, size, false);
74    }
75
76    private Format(Instruction.InstructionFactory factory, int size, boolean variableSizeFormat) {
77        this.Factory = factory;
78        this.size = size;
79        this.variableSizeFormat = variableSizeFormat;
80    }
81}
82