4 * License : The MIT License
5 * Copyright(c) 2020 olyutorskii
8 package jp.sfjp.jindolf.data.html;
10 import jp.sourceforge.jindolf.corelib.VillageState;
13 * Village record on HTML.
15 class VillageRecord implements Comparable<VillageRecord> {
17 private final String villageId;
18 private final String fullVillageName;
19 private final VillageState villageStatus;
21 private final int villageIdNum;
27 * @param villageId village id on CGI query
28 * @param fullVillageName full village name
29 * @param villageStatus village status
31 VillageRecord(String villageId,
32 String fullVillageName,
33 VillageState villageStatus ){
36 this.villageId = villageId;
37 this.fullVillageName = fullVillageName;
38 this.villageStatus = villageStatus;
40 this.villageIdNum = Integer.parseInt(villageId);
46 * return village id on CGI query.
50 String getVillageId(){
51 return this.villageId;
55 * return long village name.
57 * @return long village name
59 String getFullVillageName(){
60 return this.fullVillageName;
64 * return village status.
66 * @return village status
68 VillageState getVillageStatus(){
69 return this.villageStatus;
77 * @param rec {@inheritDoc}
78 * @return {@inheritDoc}
81 public int compareTo(VillageRecord rec) {
82 int result = this.villageIdNum - rec.villageIdNum;
89 * @return {@inheritDoc}
92 public int hashCode() {
93 return this.villageId.hashCode();
99 * @param obj {@inheritDoc}
100 * @return {@inheritDoc}
103 public boolean equals(Object obj) {
104 if(this == obj) return true;
105 if(obj == null) return false;
107 if(! (obj instanceof VillageRecord)) return false;
108 VillageRecord other = (VillageRecord) obj;
110 return this.villageId.equals(other.villageId);