Debian Codegraph @

src/uk/me/parabola/imgfmt/mps/MapBlock.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2007,2011.
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 3 or
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13 package uk.me.parabola.imgfmt.mps;
14
15 import java.io.IOException;
16
17 import uk.me.parabola.io.StructuredOutputStream;
18
19 /**
20 * A block describing an individual map.
21 *
22 * The family id, product id, series name, area name and map description can
23 * be set per map.
24 *
25 * @author Steve Ratcliffe
26 */
27 public class MapBlock extends MpsBlock {
28 private static final int BLOCK_TYPE = 0x4c;
29
30 private int familyId;
31 private int productId;
32
33 private int mapNumber;
34 private int hexNumber;
35 private String seriesName;
36 private String mapDescription;
37 private String areaName;
38
39 public MapBlock(int codePage) {
40 super(BLOCK_TYPE, codePage);
41 }
42
43 protected void writeBody(StructuredOutputStream out) throws IOException {
44 out.write2(productId);
45 out.write2(familyId);
46 out.write4(mapNumber);
47 out.writeString(seriesName);
48 out.writeString(mapDescription);
49 out.writeString(areaName);
50 out.write4(hexNumber);
51 out.write4(0);
52 }
53
54 public void setIds(int familyId, int productId) {
55 this.familyId = familyId;
56 this.productId = productId;
57 }
58
59 public void setSeriesName(String seriesName) {
60 this.seriesName = seriesName;
61 }
62
63 public void setMapNumber(int mapNumber) {
64 this.mapNumber = mapNumber;
65 }
66
67 public void setHexNumber(int hexNumber) {
68 this.hexNumber = hexNumber;
69 }
70
71 public void setMapDescription(String mapDescription) {
72 this.mapDescription = mapDescription;
73 }
74
75 public void setAreaName(String areaName) {
76 this.areaName = areaName;
77 }
78
79 public int getFamilyId() {
80 return familyId;
81 }
82
83 public int getProductId() {
84 return productId;
85 }
86
87 public int getMapNumber() {
88 return mapNumber;
89 }
90
91 public int getHexNumber() {
92 return hexNumber;
93 }
94
95 public String getSeriesName() {
96 return seriesName;
97 }
98
99 public String getMapDescription() {
100 return mapDescription;
101 }
102
103 public String getAreaName() {
104 return areaName;
105 }
106 }