| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
package uk.me.parabola.imgfmt.app.mdr; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
public class Mdr4Record implements Comparable<Mdr4Record> { |
| 20 |
private final int type; |
| 21 |
private final int subtype; |
| 22 |
private int unknown; |
| 23 |
|
| 24 |
public Mdr4Record(int type, int subtype) { |
| 25 |
this.type = type; |
| 26 |
this.subtype = subtype; |
| 27 |
} |
| 28 |
|
| 29 |
public int compareTo(Mdr4Record o) { |
| 30 |
int t1 = ((type << 8) + subtype) & 0xffff; |
| 31 |
int t2 = ((o.type << 8) + o.subtype) & 0xffff; |
| 32 |
return Integer.compare(t1, t2); |
| 33 |
} |
| 34 |
|
| 35 |
public boolean equals(Object o) { |
| 36 |
if (this == o) return true; |
| 37 |
if (o == null || getClass() != o.getClass()) return false; |
| 38 |
|
| 39 |
Mdr4Record that = (Mdr4Record) o; |
| 40 |
|
| 41 |
if (subtype != that.subtype) return false; |
| 42 |
return (type == that.type); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
public int hashCode() { |
| 47 |
int result = type; |
| 48 |
result = 31 * result + subtype; |
| 49 |
return result; |
| 50 |
} |
| 51 |
|
| 52 |
public int getType() { |
| 53 |
return type; |
| 54 |
} |
| 55 |
|
| 56 |
public int getSubtype() { |
| 57 |
return subtype; |
| 58 |
} |
| 59 |
|
| 60 |
public int getUnknown() { |
| 61 |
return unknown; |
| 62 |
} |
| 63 |
|
| 64 |
public void setUnknown(int unknown) { |
| 65 |
this.unknown = unknown; |
| 66 |
} |
| 67 |
} |