Debian Codegraph @

src/uk/me/parabola/imgfmt/mps/ProductBlock.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: Dec 19, 2007
16 */
17 package uk.me.parabola.imgfmt.mps;
18
19 import java.io.IOException;
20
21 import uk.me.parabola.io.StructuredOutputStream;
22
23 /**
24 * A block describing a particular product. Not sure how this relates
25 * to the map set.
26 *
27 * @author Steve Ratcliffe
28 */
29 public class ProductBlock extends MpsBlock {
30 private static final int BLOCK_TYPE = 0x46;
31
32 private int familyId;
33 private int productId;
34 private String description = "OSM maps";
35
36 public ProductBlock(int codePage) {
37 super(BLOCK_TYPE, codePage);
38 }
39
40 protected void writeBody(StructuredOutputStream out) throws IOException {
41 out.write2(productId);
42 out.write2(familyId);
43 out.writeString(description);
44 }
45
46 public void setFamilyId(int familyId) {
47 this.familyId = familyId;
48 }
49
50 public int getFamilyId() {
51 return familyId;
52 }
53
54 public void setProductId(int productId) {
55 this.productId = productId;
56 }
57
58 public int getProductId() {
59 return productId;
60 }
61
62 public void setDescription(String description) {
63 this.description = description;
64 }
65
66 public String getDescription() {
67 return description;
68 }
69
70 public boolean equals(Object o) {
71 if (this == o) return true;
72 if (o == null || getClass() != o.getClass()) return false;
73
74 ProductBlock that = (ProductBlock) o;
75
76 if (familyId != that.familyId) return false;
77 if (productId != that.productId) return false;
78
79 return true;
80 }
81
82 public int hashCode() {
83 int result = familyId;
84 result = 31 * result + productId;
85 return result;
86 }
87 }