| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package uk.me.parabola.imgfmt.app.lbl; |
| 18 |
|
| 19 |
import uk.me.parabola.imgfmt.app.Label; |
| 20 |
import uk.me.parabola.imgfmt.app.ImgFileWriter; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public class Region { |
| 28 |
private int index; |
| 29 |
|
| 30 |
private final Country country; |
| 31 |
private final Label label; |
| 32 |
|
| 33 |
public Region(Country country, Label label) { |
| 34 |
this.country = country; |
| 35 |
this.label = label; |
| 36 |
} |
| 37 |
|
| 38 |
public void write(ImgFileWriter writer) { |
| 39 |
writer.put2u(country.getIndex()); |
| 40 |
writer.put3u(label.getOffset()); |
| 41 |
} |
| 42 |
|
| 43 |
public int getIndex() { |
| 44 |
assert index > 0 : "Index not yet set"; |
| 45 |
return index; |
| 46 |
} |
| 47 |
|
| 48 |
public Country getCountry() { |
| 49 |
return country; |
| 50 |
} |
| 51 |
|
| 52 |
public void setIndex(int index) { |
| 53 |
this.index = index; |
| 54 |
} |
| 55 |
|
| 56 |
public Label getLabel() { |
| 57 |
return label; |
| 58 |
} |
| 59 |
} |