Debian Codegraph @

src/uk/me/parabola/imgfmt/app/lbl/Region.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2007 Steve Ratcliffe
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 *
14 * Author: Steve Ratcliffe
15 * Create date: Jan 1, 2008
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 * A region is in a country and contains one or more cities.
24 *
25 * @author Steve Ratcliffe
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 }