| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
package uk.me.parabola.imgfmt.app.mdr; |
| 14 |
|
| 15 |
import java.text.Collator; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public class Mdr5Record extends RecordBase implements NamedRecord { |
| 25 |
|
| 26 |
private int cityIndex; |
| 27 |
|
| 28 |
|
| 29 |
private int globalCityIndex; |
| 30 |
|
| 31 |
private int regionIndex; |
| 32 |
private int lblOffset; |
| 33 |
private int stringOffset; |
| 34 |
private String name; |
| 35 |
private Mdr13Record region; |
| 36 |
private Mdr14Record country; |
| 37 |
private int[] mdr20; |
| 38 |
private int mdr20Index; |
| 39 |
private int mdr20SortPos; |
| 40 |
private int mdr21SortPos; |
| 41 |
private int mdr22SortPos; |
| 42 |
|
| 43 |
public int getCityIndex() { |
| 44 |
return cityIndex; |
| 45 |
} |
| 46 |
|
| 47 |
public void setCityIndex(int cityIndex) { |
| 48 |
this.cityIndex = cityIndex; |
| 49 |
} |
| 50 |
|
| 51 |
public int getGlobalCityIndex() { |
| 52 |
return globalCityIndex; |
| 53 |
} |
| 54 |
|
| 55 |
public void setGlobalCityIndex(int globalCityIndex) { |
| 56 |
this.globalCityIndex = globalCityIndex; |
| 57 |
} |
| 58 |
|
| 59 |
public int getRegionIndex() { |
| 60 |
return regionIndex; |
| 61 |
} |
| 62 |
|
| 63 |
public void setRegionIndex(int regionIndex) { |
| 64 |
this.regionIndex = regionIndex; |
| 65 |
} |
| 66 |
|
| 67 |
public int getLblOffset() { |
| 68 |
return lblOffset; |
| 69 |
} |
| 70 |
|
| 71 |
public void setLblOffset(int lblOffset) { |
| 72 |
this.lblOffset = lblOffset; |
| 73 |
} |
| 74 |
|
| 75 |
public int getStringOffset() { |
| 76 |
return stringOffset; |
| 77 |
} |
| 78 |
|
| 79 |
public void setStringOffset(int stringOffset) { |
| 80 |
this.stringOffset = stringOffset; |
| 81 |
} |
| 82 |
|
| 83 |
public void setName(String name) { |
| 84 |
this.name = name; |
| 85 |
} |
| 86 |
|
| 87 |
public String getName() { |
| 88 |
return name; |
| 89 |
} |
| 90 |
|
| 91 |
public Mdr13Record getMdrRegion() { |
| 92 |
return region; |
| 93 |
} |
| 94 |
|
| 95 |
public void setMdrRegion(Mdr13Record region) { |
| 96 |
this.region = region; |
| 97 |
} |
| 98 |
|
| 99 |
public Mdr14Record getMdrCountry() { |
| 100 |
return country; |
| 101 |
} |
| 102 |
|
| 103 |
public void setMdrCountry(Mdr14Record country) { |
| 104 |
this.country = country; |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
public void setMdr20set(int[] mdr20) { |
| 117 |
this.mdr20 = mdr20; |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
public void setMdr20Index(int mdr20Index) { |
| 125 |
this.mdr20Index = mdr20Index; |
| 126 |
} |
| 127 |
|
| 128 |
public int getMdr20() { |
| 129 |
return mdr20[mdr20Index]; |
| 130 |
} |
| 131 |
|
| 132 |
public void setMdr20(int n) { |
| 133 |
int prev = mdr20[mdr20Index]; |
| 134 |
assert prev == 0 || prev == n : "mdr20 value changed f=" + prev + " t=" + n + " count=" + mdr20Index; |
| 135 |
|
| 136 |
mdr20[mdr20Index] = n; |
| 137 |
} |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
public boolean isSameByMapAndName(Collator collator, Mdr5Record other) { |
| 144 |
if (other == null) |
| 145 |
return false; |
| 146 |
|
| 147 |
return getMapIndex() == other.getMapIndex() && isSameByName(collator, other); |
| 148 |
} |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
public boolean isSameByName(Collator collator, Mdr5Record other) { |
| 158 |
if (other == null) |
| 159 |
return false; |
| 160 |
|
| 161 |
return collator.compare(getName(), other.getName()) == 0 |
| 162 |
&& collator.compare(getRegionName(), other.getRegionName()) == 0 |
| 163 |
&& collator.compare(getCountryName(), other.getCountryName()) == 0; |
| 164 |
} |
| 165 |
|
| 166 |
public String toString() { |
| 167 |
return String.format("%d: %s r=%s c=%s", globalCityIndex, name, getRegionName(), country.getName()); |
| 168 |
} |
| 169 |
|
| 170 |
public String getRegionName() { |
| 171 |
if (region == null) |
| 172 |
return ""; |
| 173 |
else |
| 174 |
return region.getName(); |
| 175 |
} |
| 176 |
|
| 177 |
public String getCountryName() { |
| 178 |
return country.getName(); |
| 179 |
} |
| 180 |
|
| 181 |
public void setMdr20SortPos(int n) { |
| 182 |
mdr20SortPos = n; |
| 183 |
} |
| 184 |
|
| 185 |
public int getMdr20SortPos() { |
| 186 |
return mdr20SortPos; |
| 187 |
} |
| 188 |
public void setMdr21SortPos(int n) { |
| 189 |
mdr21SortPos = n; |
| 190 |
} |
| 191 |
|
| 192 |
public int getMdr21SortPos() { |
| 193 |
return mdr21SortPos; |
| 194 |
} |
| 195 |
|
| 196 |
public void setMdr22SortPos(int n) { |
| 197 |
mdr22SortPos = n; |
| 198 |
} |
| 199 |
|
| 200 |
public int getMdr22SortPos() { |
| 201 |
return mdr22SortPos; |
| 202 |
} |
| 203 |
} |