RegisterType.java revision d27ca7f7a61cfbe60e1c490bf645257d7d59fd39
1package org.jf.dexlib.Code.Analysis;
2
3import org.jf.dexlib.TypeIdItem;
4
5public class RegisterType {
6    public final Category category;
7    public final TypeIdItem type;
8
9    protected RegisterType(Category category, TypeIdItem type) {
10        this.category = category;
11        this.type = type;
12    }
13
14    @Override
15    public boolean equals(Object o) {
16        if (this == o) return true;
17        if (o == null || getClass() != o.getClass()) return false;
18
19        RegisterType that = (RegisterType) o;
20
21        if (category != that.category) return false;
22        if (type != null ? !type.equals(that.type) : that.type != null) return false;
23
24        return true;
25    }
26
27    @Override
28    public int hashCode() {
29        int result = category.hashCode();
30        result = 31 * result + (type != null ? type.hashCode() : 0);
31        return result;
32    }
33
34
35    /*private static RegisterType[][] mergeTable  =
36        {
37               //Unknown        Null            Nonreference    Reference   Conflicted
38                {Unknown,       Null,           NonReference,   Reference,  Conflicted}, //Unknown
39                {Null,          Null,           NonReference,   Reference,  Conflicted}, //Null
40                {NonReference,  NonReference,   NonReference,   Conflicted, Conflicted}, //NonReference
41                {Reference,     Reference,      Conflicted,     Reference,  Conflicted}, //Referenced
42                {Conflicted,    Conflicted,     Conflicted,     Conflicted, Conflicted}, //Conflicted
43        };*/
44
45    /*public static RegisterType mergeRegisterTypes(RegisterType type1, RegisterType type2) {
46        return mergeTable[type1.ordinal()][type2.ordinal()];
47    }*/
48
49    public static enum Category {
50        Unknown,
51        Null,
52        NonReference,
53        Reference,
54        Conflicted
55    }
56}
57