| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 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 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 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 |
} |